Exam 2v0-7222 All QuestionsBrowse all questions from this exam
Question 70

Which two mechanisms of autowiring a dependency when multiple beans match the dependency's type are correct? (Choose two.)

    Correct Answer: A, D

    Use of @Qualifier annotation on the class and @Autowired annotation either on a field or setter methods allows for clear specification of which bean should be injected when multiple beans of the same type are available. Additionally, using @Qualifier and @Autowired annotations together on a field can also specify the injection of the correct bean. These approaches ensure precision and reduce ambiguity in dependency injection.

Discussion
GlothanOptions: AD

Option A is correct. You can use the @Qualifier annotation along with @Autowired either on a field or setter methods to specify which bean should be injected when multiple beans of the same type are available. Option B is incorrect. Using @Qualifier and @Autowired together with setter methods is not a common or recommended practice.

2211094Options: AB

AB is correct