spring引入HikariCP连接池

时间:2022-08-07 16:18:37

1、导入jar包

spring引入HikariCP连接池

2、applicationContext.xml中配置

<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource"
destroy-method="shutdown">
<property name="driverClassName" value="${data.driverClassName}"></property>
<property name="jdbcUrl" value="${data.url}"></property>
<property name="username" value="${data.username}"></property>
<property name="password" value="${data.password}"></property>
<property name="readOnly" value="false" />
<property name="connectionTimeout" value="30000" />
<property name="idleTimeout" value="600000" />
<property name="maxLifetime" value="1800000" />
<property name="maximumPoolSize" value="15" />
</bean>

3、据说HikariCP是目前性能最好的连接池