我最近将我的 Spring RESTful API 数据源从 DriverManagerDataSource 切换到了 HikariCp,但是我的数据库连接从 20 个连接变成了 600 个连接。这假设会发生吗?
我的设置如下:
<bean id="jdbcDataSource"
class="com.zaxxer.hikari.HikariDataSource" destroy-method="shutdown">
<constructor-arg>
<bean class="com.zaxxer.hikari.HikariConfig">
<constructor-arg>
<props>
<prop key="dataSource.url">url</prop>
<prop key="dataSource.user">user</prop>
<prop key="dataSource.password">password</prop>
<prop key="dataSource.cachePrepStmts">true</prop>
<prop key="dataSource.prepStmtCacheSize">250</prop>
<prop key="dataSource.prepStmtCacheSqlLimit">2048</prop>
<prop key="dataSource.useServerPrepStmts">true</prop>
</props>
</constructor-arg>
<property name="dataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" />
</bean>
</constructor-arg>
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="jdbcDataSource" />
</bean>