Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans

Consider 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

***************************
APPLICATION FAILED TO START
***************************

Description:
Action:

Consider 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

考虑将其中一个bean标记为@Primary,更新使用者以接受多个bean,或者使用@Qualifier标识应该使用的bean

出现这个错误主要是你的spring里面的bean名字重复了。
在注解后可以加不同的名字区分bean。

 @Bean(name = "name")
 @Bean(name = "beanName")
 @Component("defaultName")
 @Service("primarilyName")

仔细排查在错误日志可以得到具体的错误位置,直接定位到错误。

你可能感兴趣的:(java,spring,java)