To resolve ambiguity and specify which bean should be wired when there are multiple beans of the same type, one can use the _____ annotation in Spring
- @Component
- @Qualifier
- @Repository
- @Service
To resolve ambiguity when there are multiple beans of the same type, the "@Qualifier" annotation in Spring is used. It allows you to specify which bean should be wired by providing the name or ID of the desired bean. The other annotations, such as "@Component," "@Service," and "@Repository," are used for different purposes, like marking classes for component scanning, but they do not resolve bean wiring ambiguity.
Loading...
Related Quiz
- In a Spring Boot application, how would you handle a scenario where different microservices need to work with different databases and schemas?
- For a service to register itself with Eureka, it must have the _____ annotation in its main application class.
- The Spring Boot _____ properties file allows users to configure the application's settings.
- In Spring Boot, the _____ annotation is used to indicate that a method's return value should be stored in the cache.
- What is the main responsibility of an OAuth2 Authorization Server in a Spring Boot application?