springboot中配置druid的依赖,与application.yml中设置druid的相关配置
2023-09-18
<dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.2.16</version> </dependency>
application.yml
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ssm?serverTimezone=UTC
username: root
password: 123456
druid:
stat-view-servlet: # 配置监控页功能
enabled: true
login-username: admin
login-password: admin
reset-enable: false
filters: stat,wall,slf4j # 底层开启功能,stat(sql监控),wall(防火墙)
aop-patterns: com.hh.* # 监控springbean
web-stat-filter: # 监控web
enabled: true
url-pattern: /*
exclusions: '*.js,*.gif,*.jpg,*.png,*.ico,/druid/*'
filter:
stat:
slow-sql-millis: 1000
log-slow-sql: true