0
点赞
收藏
分享

微信扫一扫

application-druid.yml 配置案例


前言描述目的

主要是作为记录,刚刚开始一个数据库连接的时候,进行的阿里连接池的配置详情的案例。一个datasource的详情案例,配置文件为yml。主要是针对SpringBoot启动时的加载项!

配置文件里面的详情:

application-druid.yml

spring:
datasource:
# 数据源基本配置
username: root
password: 123456
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/springboot
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
poolPreparedStatements: true
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
filters: stat,wall,log4j
maxPoolPreparedStatementPerConnectionSize: 20
useGlobalDataSourceStat: true
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500

application-druid.yml 配置案例_开发语言

 

举报

相关推荐

0 条评论