package com.easy.context;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import com.easy.core.Context;
import com.easy.main.H2Server;
@WebListener
public class ContextListener implements ServletContextListener {

	H2Server h2 = new H2Server();
	@Override
	public void contextInitialized(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		//启动数据库
		h2.startServer();
		//提前装载一下Context
		Context.getInjector();
	}

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		h2.stopServer();
	}

}
