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) {



listener = null;

System.out.println(“web app undeployed”);


publicvoid contextInitialized(ServletContextEvent event) {


new Thread(){

publicvoid run() {




System.out.println(“Web app is ready.”);



and add those lines to servlet at web.xml


About lorddisk

WebCenter Content, WebCenter Portal, WebCenter Sites,Weblogic, Identity and Access Management (IAM),SSO,OAM,OIM,OAAM,OUD, OPAM,OID, OVD ,Oracle API Gateway ,OBIEE,OEDQ, Oracle ADF, Oracle SOA,J2EE, CackePHP ,PHP,J2SE,J2EE,Spring,Hibernate,JQuery,CSS,Java Script ,Joomla,Drupal,Worpress
This entry was posted in java and tagged , . Bookmark the permalink.