springboot 多数据源问题

来源:互联网 发布:牛头酋长wq二连优化 编辑:程序博客网 时间:2024/06/06 17:13

No qualifying bean of type [javax.sql.DataSource] is defined: expected single matching bean but found 2: zscq-detail-dataSource,count-dataSource

解决办法:
spring boot 启动类加上 exclude = DataSourceAutoConfiguration.class 代表启动项目的时候 不加载这个类
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})