我无法将一些 Hikari 属性设置到我的连接中。在这一点上,我没有错过什么。
<bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig">
<property name="poolName" value="springHikariCP" />
<property name="connectionTestQuery" value="SELECT 1" />
<property name="dataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" />
<property name="dataSourceProperties">
<props>
<prop key="url">jdbc:mysql://localhost:3306/mysql_demo?zeroDateTimeBehavior=convertToNull</prop>
<prop key="user">root</prop>
<prop key="password">admin</prop>
<prop key="maximumPoolSize">50</prop>
<prop key="maxLifetime">28000</prop>
<prop key="idleTimeout">30000</prop>
<prop key="prepStmtCacheSize">250</prop>
<prop key="prepStmtCacheSqlLimit">2048</prop>
<prop key="cachePrepStmts">true</prop>
<prop key="useServerPrepStmts">true</prop>
</props>
</property>
</bean>
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
<constructor-arg ref="hikariConfig" />
</bean>
当我设置 maxLifetime 属性时,我得到这个错误:
java.beans.IntrospectionException: Method not found: setMaxLifetime
at java.beans.PropertyDescriptor.<init>(Unknown Source)
at com.zaxxer.hikari.util.PropertyBeanSetter.setProperty(PropertyBeanSetter.java:125)
at com.zaxxer.hikari.util.PropertyBeanSetter.setTargetFromProperties(PropertyBeanSetter.java:63)
at com.zaxxer.hikari.pool.PoolUtilities.initializeDataSource(PoolUtilities.java:103)
at com.zaxxer.hikari.pool.BaseHikariPool.<init>(BaseHikariPool.java:153)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:61)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:49)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:78)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
我在用着 :
Hibernate 4.3.7.Final 和 Mysql 连接器 5.1.21 和 HikariCP :
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-java6</artifactId>
<version>2.3.2</version>
</dependency>