1 16 17 package org.springframework.web.context; 18 19 import javax.servlet.ServletContextEvent ; 20 import javax.servlet.ServletContextListener ; 21 22 39 public class ContextLoaderListener implements ServletContextListener { 40 41 private ContextLoader contextLoader; 42 43 44 47 public void contextInitialized(ServletContextEvent event) { 48 this.contextLoader = createContextLoader(); 49 this.contextLoader.initWebApplicationContext(event.getServletContext()); 50 } 51 52 56 protected ContextLoader createContextLoader() { 57 return new ContextLoader(); 58 } 59 60 64 public ContextLoader getContextLoader() { 65 return this.contextLoader; 66 } 67 68 69 72 public void contextDestroyed(ServletContextEvent event) { 73 if (this.contextLoader != null) { 74 this.contextLoader.closeWebApplicationContext(event.getServletContext()); 75 } 76 } 77 78 } 79 | Popular Tags |