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("监听器初始化......"); } }
程序员的眼里,不止有代码和bug,还有诗与远方和妹子!!!