spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/test username: root password: root 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 pool-prepared-statements: true max-pool-prepared-statement-per-connection-size: 20 filters: stat,wall,log4j connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
下面这部分是解释
initial-size: 初始化连接数 min-idle: 最小空闲连接数 max-active: 最大活跃连接数 max-wait: 获取连接最大等待时间 time-between-eviction-runs-millis: 连接回收线程运行时间间隔 min-evictable-idle-time-millis: 连接空闲时间大于该值才回收 validation-query: 连接验证语句 test-while-idle: 空闲连接是否验证 test-on-borrow: 获取连接前是否验证 test-on-return: 归还连接前是否验证 pool-prepared-statements: 是否启用预处理语句池 max-pool-prepared-statement-per-connection-size: 预处理语句池中最大预处理语句数 filters: Druid 提供的过滤器 connection-properties: 连接属性配置
标签:数据源,druid,完事,idle,max,test,连接,pool From: https://www.cnblogs.com/stepforeward/p/17077500.html