Which two mechanisms of autowiring a dependency when multiple beans match the dependency's type are correct? (Choose two.)
Which two mechanisms of autowiring a dependency when multiple beans match the dependency's type are correct? (Choose two.)
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.
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.
AB is correct