java 代码
public class LoadTreeForXML implements ServletContextListener {
public void contextInitialized(ServletContextEvent servletContextEvent) {
ServletContext servletContext = servletContextEvent.getServletContext();
ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
//将数据放到缓存中。
servletContext.setAttribute("allNotLeafNodeList", "AAAAAAAAAAAAAAAAAAA");
servletContextEvent.getServletContext().removeAttribute("allNotLeafNodeList");
}
public void contextDestroyed(ServletContextEvent servletContextEvent) {
System.out.println("关闭信息!");
}