重构遇到个小问题,记录下: 错误信息: *************************** 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…
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…
我在其他类注入的时候出现以下错误 @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…
@Autowired注解是spring用来支持依赖注入的核心利器之一,但是我们或多或少都会遇到required a single bean, but 2 were found(2可能是其他数字)的问题,接下来我们从源码的角度去看为什么会出现这个问题,以及这个问题的解法是什么? 首先我们写一个demo来复现一下这个问题.首先我们有一个抽象类AbstractAutowiredDemo,两个实现类AutowiredDemo1,AutowiredDemo2.然后我们在AutowiredDemoContr…
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…
示例: DATA: wa_t001 type t001. select single for update * into wa_t001 from t001 where bukrs = '1000'. 解释: select single for update,where条件必须涵盖所有主键. 执行时,该语句会锁定满足条件的单条数据(在SM12中是看不到的). 锁定退出条件:执行到commit或rollback. 补充: 如果有其他的select single for update访问到同样的数据…