Broadcom-VMware
2V0-72.22 · Question #91
Which two mechanisms of autowiring a dependency when multiple beans match the dependency's type are correct? (Choose two.)
The correct answer is A. Use of @Qualifier annotation on the class and @Autowired annotation either on a field or setter D. Use of @Qualifier and @Autowired annotations together on a field. See the full explanation below for the reasoning.
Question
Which two mechanisms of autowiring a dependency when multiple beans match the dependency's type are correct? (Choose two.)
Options
- AUse of @Qualifier annotation on the class and @Autowired annotation either on a field or setter
- BUse of @Qualifier and @Autowired annotations together with setter methods.
- CUse of @Qualifier annotation only with setter methods (@Autowired is optional for setters).
- DUse of @Qualifier and @Autowired annotations together on a field.
- EUse of @Qualifier annotation only on a field (@Autowired is optional for fields).
How the community answered
(42 responses)- A81% (34)
- B2% (1)
- C12% (5)
- E5% (2)
Community Discussion
No community discussion yet for this question.