Parameter 0 of method sqlSessionTemplate in org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration required a single bean, but 2 were found:


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: defined by method 'crmDataSource' in class path resource [com/config/MultipleDBConfig.class] 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



坑:以上方式鏈接多數據源時,

在springboot1.x時  datasource上要在一個寫數據源上標記@Primary為主數據源

而在springboot2.X時則不需要


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM