springboot2.X+sharding-jdbc 3.0+mybatis 2.1.0
When PageHelper 1.3.0 was introduced, the project could not start
***************************
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
Solution:
1.
automatically configure the priority problem. Add the org.apache.shardingsphere package path in @ componetscan to improve the scanning priority and solve the problem
@ componentscan (value = {“io. Shardingsphere. *” and “your other package names”})
2. Automatic injection of data source is prohibited
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
Manual injection
https://www.cnblogs.com/inbeijing/p/14419108.html
Read More:
- Error creating bean with name ‘helloController‘: Injection of autowired dependencies failed;
- @Autowired injection * * required a single bean, but 2 were found**
- No qualifying bean of type ‘javax.sql.DataSource‘ available: expected at least 1
- Springboot startup error failed to configure a datasource
- Error creating bean with name ‘datasource’ defined in class path resource
- Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
- Failed to configure a DataSource
- Springboot project startup exception – required a single bean, but 2 were found
- Error creating bean with name ‘application‘: Instantiation of bean failed;
- Failed to configure a DataSource: ‘ url’ attribute
- Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded
- Springboot startup exception: error creating bean with name ‘permissioncontroller’
- Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded (How to Fix)
- Floor() error injection
- UITableView failed to obtain a cell from its dataSource?
- Ctfhub error injection
- 12-web security — error injection based on SQL Server — and, convert, cast
- SQL injection for ASP + access website
- Consider defining a bean named ‘entityManagerFactory‘ in your configuration.