<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
……
</bean>
当tomcat关闭的时候会自动调用contextDestroyed(ServletContextEvent event)这个方法,
AbstractApplicationContext.Close这个方法是要你自己调用的,在程序要结束的时候保证调用这个close方法,在这里的话就是由Listener来保证tomcat退出的时候调用close方法
其实就是调用context里面的beanFactory的destroySingletons()方法了
这个消息是要靠外部(程序员)来提供的
分享到:
相关推荐
destroy-method="close"> <property name="driverClassName"> <value>org.gjt.mm.mysql.Driver <property name="url"> <value>jdbc:mysql://localhost:3306/demo <property name="username"> ...
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <property name="url" value="jdbc:mysql://localhost:3306/test?useSSL=false"/> ...
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql:...
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql...
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <property name="jdbcUrl" ...
JSP Spring中Druid连接池配置 jdbc.properties url=jdbc:postgresql://***.... <bean id=dataSource class=com.alibaba.druid.pool.DruidDataSource init-method=init destroy-method=close> <!-- 基本属性 url、u
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql:...
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql:/...
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql...
-- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" lazy-init="false"> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" ...
<bean id="derby-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>org.apache.derby.jdbc.EmbeddedDriver <property name="url"> ...
<bean id="dataSource" name="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName}"/> <property name="url...
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql...
<bean id="dataSource1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${db1.driver}" /> <property name="url" value="${db1.url}" /> ...
<bean id="dataSource1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <!-- 数据库连接属性 --> <bean id="dataSource2" class=...
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close"> <!-- Connection Info --> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url...
这个注解会告诉Spring在执行该方法时启动一个新的事务,如果出现异常则回滚,否则提交事务。对于跨数据库的场景,Atomikos会自动处理这些事务边界,确保所有操作要么全部成功,要么全部失败。 ```java @Service ...
<bean id="dataSource1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <!-- 数据库连接信息 --> <bean id="dataSource2" class="org.apache.commons.dbcp.BasicDataSource" destroy...
<bean id="dataSource1" class="org.apache.commons.dbcp.BasicDataSource" init-method="init" destroy-method="close"> <!-- 数据源配置 --> <property name="driverClassName" value="com.mysql.jdbc.Driver"/>...
<bean id="dataSource1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <!-- 配置数据库连接信息 --> <bean id="dataSource2" class="org.apache.commons.dbcp.BasicDataSource" ...