nerdexam
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)
  • A
    81% (34)
  • B
    2% (1)
  • C
    12% (5)
  • E
    5% (2)

Community Discussion

No community discussion yet for this question.

Full 2V0-72.22 Practice