脚本宝典收集整理的这篇文章主要介绍了springboot 整合druid,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
druid 官方文档 : druid/druid-sPRing-boot-starter at master · alibaba/druid (gIThub.COM)
<dePEndency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.17</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mySQL</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
spring:
# 数据库
datasource:
url: jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&characterEncoding=utf-8
username: root
password: root
配置防火墙、监控页,开启web监控
spring:
# 数据库
datasource:
url: jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&characterEncoding=utf-8
username: root
password: root
# druid 配置
druid:
# 配置监控防火墙功能
filters: stat,wall # 这两个详细参数可通过 filter-xxx 配置
filter:
stat:
enabled: true
slow-sql-millis: 1000 # 设置 1000ms 为慢查询
LOG-slow-sql: true # 开启慢查询监控
wall: # 在这里可配置 不允许更新、不允许删除等操作
enabled: true
# 开启监控页,并配置账号密码
stat-view-servlet:
enabled: true
login-username: admin
login-password: admin
# reset-enable: false # 重置按钮
# 开启web 监控功能。 urlPattern 和 exclusions 有默认值
web-stat-filter:
enabled: true
# aop-patterns: cc.acdongla.boot.* 配置监控包
http://localhost:8080/druid/
可进入 druid 的监控页以上是脚本宝典为你收集整理的springboot 整合druid全部内容,希望文章能够帮你解决springboot 整合druid所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。