Using the Java Spring Framework,
Creating web applications
However, I want to register more than one Bean, but it doesn't work.
Want to handle more than one Bean
Consumer marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed
·What I did to resolve the error
ServiceExamInfoImpl.javajava spring spring-boot
It is important to know which bean the error message in the question statement appears for.Just before the error message appears in the question text, you will also see what the problem is.
If the code in the question is possible, you may have tried to auto-wire the
TestService, but in this case, for example,
@Qualifier should be given as follows:
The default qualifier value is bean name, and the default bean name is lowercase at the beginning of the class name.
In other words, if you do not specify anything, the
ServiceUserImpl qualifier value is
For a fallback match, the bean name is considered a default qualifier value.
If such an announcement contains no name
value or for any other detected component (such as these discovered by custom filters), the default bean name generator returns the uncapacitated non-qualified class name.
© 2022 OneMinuteCode. All rights reserved.