nerdexam
Broadcom-VMware

2V0-72.22PSE · Question #30

2V0-72.22PSE Question #30: Real Exam Question with Answer & Explanation

The correct answer is B. Ensure a valid @ComponentScan annotation in the Java configuration is specified.. To autodetect these classes and register the corresponding beans, you need to add @ComponentScan to your @Configuration class.

Question

If a class is annotated with @Component, what should be done to have Spring automatically detect the annotated class and load it as a bean? (Choose the best answer.)

Options

  • AEnsure a valid bean name in the @Component annotation is specified.
  • BEnsure a valid @ComponentScan annotation in the Java configuration is specified.
  • CEnsure a valid @Scope for the class is specified.
  • DEnsure a valid @Bean for the class is specified.

Explanation

To autodetect these classes and register the corresponding beans, you need to add @ComponentScan to your @Configuration class.

Community Discussion

No community discussion yet for this question.

Full 2V0-72.22PSE Practice
If a class is annotated with @Component, what should be done to... | 2V0-72.22PSE Q#30 Answer | NerdExam