答案 0 :(得分:0)
您需要创建一个包装数据库JDBC驱动程序的Spring Bean数据源。通常,这是通过使用池库完成的(不要尝试自己的实现)。
使用c3p0池库的示例:
<spring:beans>
<spring:bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<spring:property name="driverClass" value="${JDBC.driver}"/>
<spring:property name="jdbcUrl" value="${JDBC.URL}"/>
<spring:property name="user" value="${JDBC.user}"/>
<spring:property name="password" value="${JDBC.password}"/>
<spring:property name="minPoolSize" value="5"/>
<spring:property name="maxPoolSize" value="20"/>
<spring:property name="acquireIncrement" value="1"/>
<spring:property name="idleConnectionTestPeriod" value="100"/>
<spring:property name="maxStatements" value="0"/>
<spring:property name="checkoutTimeout" value="60000"/>
</spring:bean>
</spring:beans>
<db:generic-config name="dbConfig" dataSource-ref="dataSource"
doc:name="Generic Database Configuration" />
https://help.mulesoft.com/s/article/Spring-based-datasources
上有更多示例