HikariCP数据库连接池配置步骤

spring boot项目中,spring boot 2.0集成数据库连接池步骤:

1)依赖包
//HikariCP 数据库连接池
compile ‘com.zaxxer:HikariCP:3.1.0’

2)配置信息
在spirng boot项目的application.properties配置文件中,
#Hikari will use the above plus the following to setup connection poolingHikari will use the above plus the following to setup connection pooling
#spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=10
spring.datasource.hikari.maximum-pool-size=150
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1

你可能感兴趣的:(Java)