SpringBoot MyBatis druid database connection pool

Error problem:

Error creating bean with name 'dataSource' defined in class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.class]

When you use the druid springboot project as the database connection pool, you must remember to add a comment on the application of class springboot:

@EnableAutoConfiguration(exclude={DruidDataSourceAutoConfigure.class})

To get rid of automatic configuration of DruidDataSourceAutoConfigure, otherwise it will report the above error

the reason is:

DruidDataSourceAutoConfigure before DynamciDataSourceAutoConfiguration, it will inject a DataSourceWrapper, will find url, username, password, etc. in native spring.datasource. And we configure the path of dynamic data source is changed.

Transfer from

SpringBoot with the druid needs attention as the database connection pool that

Guess you like

Origin www.cnblogs.com/abel-he/p/9549046.html