我正在尝试在SpringBoot应用程序中配置HikariCP。但是它不起作用。附加代码段。任何帮助将不胜感激。
<bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig">
<property name="dataSourceClassName" value="oracle.jdbc.driver.OracleDataSource" />
<property name="maximumPoolSize" value="50" />
<property name="idleTimeout" value="240" />
<property name="dataSourceProperties">
<props>
<prop key="url">${javax.persistence.jdbc.url}</prop>
<prop key="user">${javax.persistence.jdbc.user}</prop>
<prop key="password">${javax.persistence.jdbc.password}</prop>
</props>
</property>
</bean>
<!-- HikariCP configuration -->
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource"
destroy-method="close">
<constructor-arg ref="hikariConfig" />
</bean>
答案 0 :(得分:1)
在您的情况下,默认情况下将配置HikariCP,因此您只需配置以下与hikari相关的可选属性即可:
spring.datasource.url=jdbc:mysql://localhost:3306/{databasename}
spring.datasource.username={user}
spring.datasource.password={password}
spring.datasource.hikari.maximum-pool-size=12
spring.datasource.hikari.idle-timeout=300000