springboot2.X+sharding-jdbc 3.0+mybatis 2.1.0
当引入pagehelper 1.3.0 时,项目起不来
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'dataSource', defined in class path resource [io/shardingsphere/shardingjdbc/spring/boot/SpringBootConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
解决办法:
1.
自动配置优先级问题,在@ComponetScan中加入org.apache.shardingsphere包路径,提高扫描优先及,问题解决。
@ComponentScan(value={“io.shardingsphere.*”, “你的其它包名”})
2.禁止自动注入数据源
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
采用手动注入
https://www.cnblogs.com/inbeijing/p/14419108.html