druid-spring-boot-starter配置

spring.datasource.druid.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.druid.url=jdbc:mysql://localhost:3306/spring_boot_db?useUnicode=true&characterEncoding=utf-8&noAccessToProcedureBodies=true
spring.datasource.druid.username=root
spring.datasource.druid.password=root
#初始连接数
spring.datasource.druid.initial-size=2
#最大连接数
spring.datasource.druid.max-active=30
#最少连接数
spring.datasource.druid.min-idle=2
#最大等待超时时间
spring.datasource.druid.max-wait=10000
spring.datasource.druid.pool-prepared-statements=true
spring.datasource.druid.query-timeout=10
spring.datasource.druid.validation-query=SELECT 1
spring.datasource.druid.use-global-data-source-stat=true

#监控配置,所有监控配置都有默认值
#查看DruidWebStatFilterConfiguration 类
spring.datasource.druid.web-stat-filter.enabled=true
#查看默认配置DruidStatViewServletConfiguration
spring.datasource.druid.stat-view-servlet.enabled=true
spring.datasource.druid.filter.wall.enabled=true
spring.datasource.druid.filter.stat.enabled=true

#慢查询
spring.datasource.druid.filter.stat.log-slow-sql=true
#慢查询时长,默认3秒
spring.datasource.druid.filter.stat.slow-sql-millis=1000

你可能感兴趣的:(java)