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("监听器初始化......");
} }