Springboot配置多数据源事务管理出错
Parameter 0 of method sqlSessionTemplate in org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration required a single bean, but 2 were found:Consider marking one of the beans as @Primary, updat
·
Parameter 0 of method sqlSessionTemplate in org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration required a single bean, but 2 were found:
Consider marking one of the beans as @Primary, updating the consumer to acce
这个原因是在springboot配置多数据源的时候,可能在某个datasource1中配置了@Primary(主要注解),此时在你的datasource2中也去配置了这个注解,name这个问题就会产生
或者是当你在某个DBconfig中在配置注解@ConfigurationProperties(“mysql.datasource.db1”)在这个注解之前去配置了@Component这个组件注解,同样也会引起报错
==============================================
报错信息
Parameter 0 of method sqlSessionTemplate in org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration required a single bean, but 2 were found:
Consider marking one of the beans as @Primary, updating the consumer to acce……
更多推荐
所有评论(0)