Druid作为一个优秀的数据库连接池,国内几乎大小项目都会用,最近项目中涉及新旧系统并用,老的Oracle性能不稳,这时候的监控就非常必要且急需了。下面说一下Druid打开监控的步骤:
1. application.yml配置
spring:
datasource:
url: jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=true
username: root
password: 123456
driver-class-name: com.mysql.jdbc.Driver #非必需
type: com.alibaba.druid.pool.DruidDataSource #非必需
druid:
initialSize: 2
minIdle: 2
maxActive: 30
######Druid监控配置######
WebStatFilter:
exclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*'
StatViewServlet:
loginUsername: druid
loginPassword: druid
2. 在这个模块的POM下添加依赖
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifa