数据访问-druid数据源starter整合方式
1、引入druid-starter
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.17</version>
</dependency>
2、配置示例
spring:
datasource:
url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=Asia/Shanghai&useServerPrepStmts=true&cachePrepStmts=true
username: qin
password: '123'
driver-class-name: com.mysql.cj.jdbc.Driver
druid:
aop-patterns: com.wenliang.admin.*
filters: stat,wall
stat-view-servlet:
enabled: true
login-username: admin
login-password: 123456
resetEnable: false
web-stat-filter:
enabled: true
urlPattern: /*
exclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*'
filter:
stat:
slow-sql-millis: 1000
logSlowSql: true
enabled: true
wall:
enabled: true
config:
drop-table-allow: false
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/71cfd0ed28ea4e24bd6210ed5d971f37.png)