package com.iamberry.common.web;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
/**
 * @company	深圳爱贝源科技有限公司
 * @website www.iamberry.com
 * @author 	献
 * @tel		18271840547
 * @date	2016年10月18日d
 * @explain	Web容器启动
 */
public class ApplicationInitListener implements ServletContextListener {

	// Spring上下文
	public static ApplicationContext applicationContext;

	private static Logger logger = Logger.getLogger(ApplicationInitListener.class);

	public void contextInitialized(ServletContextEvent event) {
		try {
			applicationContext = (WebApplicationContext) WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
		} catch (Exception e) {
		}
	}
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub
	}
}
