spring boot监听器的实现

spring boot监听器的实现

如下所示:

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

@WebListener
public class ContextListener implements ServletContextListener {

 
    public ContextListener() {
        // TODO Auto-generated constructor stub
    }

  
    public void contextDestroyed(ServletContextEvent arg0)  {
        System.out.println("监听器被销毁......");
    }

   
    public void contextInitialized(ServletContextEvent arg0)  {
        System.out.println("监听器初始化......");
    }

}

 

posted @ 2018-08-09 09:30  何其小静  阅读(227)  评论(0编辑  收藏  举报