Parameter 0 of method orderSqlSessionFactory in com.config.MultipleDBConfig required a single bean, but 2 were found: - orderDataSource: defined by method 'orderDataSource' in class path resource [com/config/MultipleDBConfig.class] - crmDataSource: d…
Field amqpTemplate in * required a single bean, but 3 were found: Spring Boot 启动的时候报的错 使用Spring Boot1.5.8版本. 系统中使用了amqp组件,同事手写了两个RouteKey的RabbitTamplate的模板,项目中*类中@Autowired了RabbitTamplate. 然后就报了这个错,意思是找到了3个模板,不知道自动注入哪一个,建议: Consider marking one of th…
重构遇到个小问题,记录下: 错误信息: *************************** APPLICATION FAILED TO START *************************** Description: Field xxxService in com.alibaba.xxx required a single bean, but 2 were found: 解决方法: Action: Consider marking one of the beans as @Pri…
@Autowired注解是spring用来支持依赖注入的核心利器之一,但是我们或多或少都会遇到required a single bean, but 2 were found(2可能是其他数字)的问题,接下来我们从源码的角度去看为什么会出现这个问题,以及这个问题的解法是什么? 首先我们写一个demo来复现一下这个问题.首先我们有一个抽象类AbstractAutowiredDemo,两个实现类AutowiredDemo1,AutowiredDemo2.然后我们在AutowiredDemoContr…
我在其他类注入的时候出现以下错误 @Autowired NodeAgentService nodeAgentService; 异常 Description: Field mibService in com.xxx.xxx.controller.SnmpController required a single bean, but 2 were found: - mibServiceImpl: defined in file [F:\xxxx\monitorcenter\target\classes…