ExamGecko
Home / VMware / 2V0-72.22 / Practice Test 1
Ask Question

VMware 2V0-72.22 Practice Test 1

Add to Whishlist
00:00:00
Show Answer
Report Issue   Restart test

Question 1 / 40

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.)

Ensure a valid bean name in the @Component annotation is specified.
Ensure a valid bean name in the @Component annotation is specified.
Ensure a valid @ComponentScan annotation in the Java configuration is specified.
Ensure a valid @ComponentScan annotation in the Java configuration is specified.
Ensure a valid @Scope for the class is specified.
Ensure a valid @Scope for the class is specified.
Ensure a valid @Bean for the class is specified.
Ensure a valid @Bean for the class is specified.
Comment (0)
Suggested answer: B
Explanation:

The @Component annotation indicates that a class is a candidate for auto-detection by Spring and can be registered as a bean in the application context. However, to enable this feature, the Java configuration class must also have the @ComponentScan annotation, which tells Spring where to look for annotated components.

asked 16/09/2024
Arash Rind
50 questions