Spring Boot实现监听器

一 代码位置

https://gitee.com/cakin24/code/tree/master/07/Servlet

二 测试

1 启动服务,控制器打印如下,说明contextInitialized起了作用

ServletContex初始化
Apache Tomcat/9.0.14

2 再次启动服务,由于端口占用,控制台打印如下,说明contextDestroyed起了作用

ServletContex销毁

 

你可能感兴趣的:(Spring,Boot,Spring,Boot)