有人知道如何制作:
com.mchange.v2.c3p0.management.ManagementCoordinator=com.mchange.v2.c3p0.management.NullManagementCoordinator
使用Spring而不是c3p0.properties文件?
答案 0 :(得分:1)
您可以定义以下bean:
<bean id="sysProps" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass"><value>java.lang.System</value></property>
<property name="targetMethod"><value>setProperty</value></property>
<property name="arguments">
<list>
<value>com.mchange.v2.c3p0.management.ManagementCoordinator</value>
<value>com.mchange.v2.c3p0.management.NullManagementCoordinator</value>
</list>
</property>
</bean>
然后,您的数据源bean定义应包含depends-on
属性,如下所示:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close" depends-on="sysProps">