1 4 package com.tctest.spring.integrationtests.framework.web; 5 6 import javax.servlet.ServletContextEvent ; 7 import javax.servlet.ServletContextListener ; 8 9 import org.springframework.context.support.ClassPathXmlApplicationContext; 10 import org.springframework.web.context.WebApplicationContext; 11 import org.springframework.web.context.support.WebApplicationContextUtils; 12 13 public class RemoteContextListener implements ServletContextListener { 14 15 private ClassPathXmlApplicationContext remoteAppCtx; 16 17 public void contextInitialized(ServletContextEvent event) { 18 WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext()); 19 remoteAppCtx = new ClassPathXmlApplicationContext( 20 new String [] { "classpath:/com/tctest/spring/spring-remoting.xml" }, wac); 21 22 } 23 24 public void contextDestroyed(ServletContextEvent event) { 25 remoteAppCtx.close(); 26 } 27 28 } 29 | Popular Tags |