<!-- druid--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.2.5</version> </dependency> <!-- log4j--> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency>
spring: datasource: username: root password: 123456 url: jdbc:mysql://localhost:3306/world?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT driver-class-name: com.mysql.cj.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource druid: #druid数据源专有配置 #初始化大小,最小,最大 initial-size: 5 min-idle: 5 max-active: 20 #等待超时 max-wait: 60000 #间隔多久进行一次检测,检测需要关闭的空闲连接,单位是毫秒 time-between-eviction-runs-millis: 60000 #一个连接在池中最小生存的时间 min-evictable-idle-time-millis: 300000 validation-query: SELECT 1 test-while-idle: true test-on-borrow: false test-on-return: false #打开PS Cache,并且指定每个连接上PS Cache的大小 pool-prepared-statements: true max-pool-prepared-statement-per-connection-size: 20 #star:监控统计,wall:防御sql注入,log4j:日志 filters: stat,wall,log4j #通过connectProperties属性来打开mergeSql功能;慢SQL记录 connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 #合并多个DruidDataSource的监控数据 use-global-data-source-stat: true #配置DruidStatFilter web-stat-filter: enabled: true url-pattern: "/*" exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*" #配置DruidStatViewServlet stat-view-servlet: url-pattern: "/druid/*" #IP白名单(没有配置或者为空,则允许所有访问) allow: 127.0.0.1 #IP黑名单 (存在共同时,deny优先于allow) #deny: 127.0.0.1 #禁用HTML页面上的“Reset All”功能 reset-enable: false #登录名 login-username: admin #登录密码 login-password: 123456 #(高版本)开启控制台! enabled: true
http://localhost:8080/druid/