Spring Boot yml檔案配置檔案內容
阿新 • • 發佈:2018-12-07
spring: ##資料庫連線資訊 datasource: url: jdbc:mysql://localhost:3306/test username: root password: driver-class-name: com.mysql.jdbc.Driver ###################以下為druid增加的配置########################### type: com.alibaba.druid.pool.DruidDataSource # 下面為連線池的補充設定,應用到上面所有資料來源中 # 初始化大小,最小,最大 initialSize: 5 minIdle: 5 maxActive: 20 # 配置獲取連線等待超時的時間 maxWait: 60000 # 配置間隔多久才進行一次檢測,檢測需要關閉的空閒連線,單位是毫秒 timeBetweenEvictionRunsMillis: 60000 # 配置一個連線在池中最小生存的時間,單位是毫秒 minEvictableIdleTimeMillis: 300000 validationQuery: SELECT 1 FROM DUAL testWhileIdle: true testOnBorrow: false testOnReturn: false # 開啟PSCache,並且指定每個連線上PSCache的大小 poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 20 # 配置監控統計攔截的filters,去掉後監控介面sql無法統計,'wall'用於防火牆,此處是filter修改的地方 filters: commons-log.connection-logger-name: stat,wall,log4j # 通過connectProperties屬性來開啟mergeSql功能;慢SQL記錄 connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 # 合併多個DruidDataSource的監控資料 useGlobalDataSourceStat: true