proxool.xml
<?xml version="1.0" encoding="UTF-8"?>
<something-else-entirely>
<proxool>
<alias>proMysql</alias>
<driver-url>jdbc:mysql://mysqlhost:3306/heating?autoReconnect=true&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull</driver-url>
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
<driver-properties>
<property name="user" value="root"/>
<property name="password" value=""/>
</driver-properties>
<maximum-connection-count>10</maximum-connection-count>
<minimum-connection-count>5</minimum-connection-count>
<house-keeping-sleep-time>90000</house-keeping-sleep-time>
<prototype-count>5</prototype-count>
<test-before-use>true</test-before-use>
<simultaneous-build-throttle>5</simultaneous-build-throttle>
<house-keeping-test-sql>SELECT CURRENT_DATE</house-keeping-test-sql>
</proxool>
</something-else-entirely>
app-config-context.xml
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<value>proxool.proMysql</value>
</property>
</bean>
监听器
public class ProxoolListener implements ServletContextListener {
private static final Log LOG = LogFactory.getLog(ProxoolListener.class);
private static final String XML_FILE_PROPERTY = "xmlFile";
private static final String PROPERTY_FILE_PROPERTY = "propertyFile";
private static final String AUTO_SHUTDOWN_PROPERTY = "autoShutdown";
@SuppressWarnings("unused")
private boolean autoShutdown = true;
public void contextDestroyed(ServletContextEvent arg0) {
System.out.println("destroy database pool....");
}
public void contextInitialized(ServletContextEvent contextEvent) {
System.out.println("proxool Initializing...");
ServletContext context = contextEvent.getServletContext(); //