springboot用yml配置druid

Posted TaylorLambert

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot用yml配置druid相关的知识,希望对你有一定的参考价值。

spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource
    filters: stat
    maxActive: 20
    initialSize: 1
    maxWait: 60000
    minIdle:
    timeBetweenEvictionRunsMillis: 60000
    minEvictionRunsMillis: 300000
    validationQuery: select ‘x‘
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    poolPreparedStatements: true
    maxOpenPreparedStatements: 20

 

以上是关于springboot用yml配置druid的主要内容,如果未能解决你的问题,请参考以下文章

springboot整合druid为啥在application.yml中配置,像initialSize之类的属性都不识别,没有了。

SpringBoot 使用yml配置 mybatis+pagehelper+druid+freemarker实例

配置(1):springboot yml配置连接池(druid,hikari),mybatis,json,log

SpringBoot配置Druid

springboot 集成druid

SpringBoot + mybatis + druid 配置两个数据源