SpringBoot之durid连接池配置

 1 datasource:
 2   type: com.alibaba.druid.pool.DruidDataSource
 3   driver-class-name: com.mysql.jdbc.Driver
 4   url: jdbc:mysql://120.78.188.120:3306/discuz?useUnicode=true&characterEncoding=utf8&useSSL=false&autoReconnect=true
 5   username: root
 6   password: 123456
 7   # 下面为连接池的补充设置,应用到上面所有数据源中
 8   initialSize: 5
 9   minIdle: 5
10   maxActive: 20
11   # 配置获取连接等待超时的时间
12   maxWait: 60000
13   # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
14   timeBetweenEvictionRunsMillis: 60000
15   # 配置一个连接在池中最小生存的时间,单位是毫秒
16   minEvictableIdleTimeMillis: 300000
17   validationQuery: SELECT 1 FROM DUAL
18   testWhileIdle: true
19   testOnBorrow: false
20   testOnReturn: false
21   # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
22   filters: stat,wall,log4j
23   logSlowSql: true
往事如烟,余生有我.
原文地址:https://www.cnblogs.com/assistants/p/10314339.html