标签:
package com.efuture.vpm.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextClosedEvent; public class ApplicationEventListener implements ApplicationListener { protected final Log log = LogFactory.getLog(getClass()); public void onApplicationEvent(ApplicationEvent event) { //容器关闭时触发的事件 if(event instanceof ContextClosedEvent ){ log.info("application close 1111111111111111111111111111111111111 "); }else{ log.info("application ohter event 222222222222222222222222222222222222222 "); } } }
<!-- 应用级的监听器 (注销esb) --> <bean id="sytemEventListener" class="com.efuture.vpm.util.ApplicationEventListener"></bean>
关闭事件的触发仅限于正常方式关闭服务器,而不是直接关闭 console窗口这样的方式。
如何在关闭web服务时进行一些清理操作(Spring mvc)
标签:
原文地址:http://blog.csdn.net/metecyu/article/details/44746855