问题
默认使用
spring.datasource.xx 直接配置
spring.datasource.url=jdbc:mysql://xxxx:xxx/xxxx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=xxx
spring.datasource.password=xxx
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.max-idle=8
spring.datasource.min-idle=8
spring.datasource.initial-size=10
Druid的控台是监控不了SQL的。
解决方案
依赖starter包
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>
配置如下:
spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driv