略。
2.方式2:SpringBoot整合Druid的jar包,开启监控中心 2.1pom.xml
com.alibaba
druid-spring-boot-starter
1.1.17
2.2application.yml
spring:
datasource:
url: jdbc:mysql://localhost:3306/graduationproject
username: root
password: 113846
driver-class-name: com.mysql.jdbc.Driver #5.x版本mysql
druid:
aop-patterns: com.example.* #监控SpringBean
filters: stat,wall,slf4j #开启web的sql监控、防火墙、日志
stat-view-servlet: #配置监控页面功能
enabled: true
login-username: admin #监控中心登录账号
login-password: admin
reset-enable: false #禁用重置按钮
web-stat-filter: #监控web
enabled: true
url-pattern: /* #匹配路径
exclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' #排除路径
filter:
stat: #对上面filters里面的stat详细设置
slow-sql-millis: 1000 #慢sql查询时间ms
log-slow-sql: true #是否开启日志记录慢查询
enabled: true
wall:
enabled: true
config:
drop-table-allow: false #不允许删表操作
#update-allow: false #所有update更新操作都会被防火墙拦截
2.3监控中心页面展示
2.3.1登录页面
2.3.1监控中心sql监控页面
需要与web项目整合,当发出sql请求(如:增删查改),监控中心的sql监控页面会进行记录。如果没有与web项目整合,监控中心内容空白。



