Tag Archives: how to make application Listener

How to use ContextLoaderListener,how to make application Listener

publicclass Main extends org.springframework.web.context.ContextLoaderListener {  /** *@param args */ DatabaseListner listener = new DatabaseListner(); publicvoid contextDestroyed(ServletContextEvent event) { super.contextDestroyed(event); listener.end(); listener = null; System.out.println(“web app undeployed”); } publicvoid contextInitialized(ServletContextEvent event) { super.contextInitialized(event); new Thread(){ publicvoid run() { listener.listen(); } }.start(); … Continue reading

Posted in java | Tagged ,