Broadcom-VMware
2V0-72.22 · Question #83
Spring bean classes are defined under a package called com.mycomp.service. What two options are required to enable component scanning? (Choose two.)
The correct answer is A. Ensure bean classes are annotated with the @Component annotation. B. Add the @ComponentScan ("com.mycomp. service") to the Java configuration. See the full explanation below for the reasoning.
Question
Spring bean classes are defined under a package called com.mycomp.service. What two options are required to enable component scanning? (Choose two.)
Options
- AEnsure bean classes are annotated with the @Component annotation.
- BAdd the @ComponentScan ("com.mycomp. service") to the Java configuration.
- CEnsure bean classes are annotated with the @Autowired annotation.
- DEnsure bean classes are annotated with the @Bean annotation.
- EEnsure bean classes are annotated with the @ComponentScan annotation.
How the community answered
(22 responses)- A86% (19)
- D5% (1)
- E9% (2)
Community Discussion
No community discussion yet for this question.