SpringBoot整合Listener的两种方式:
1.通过注解扫描完成Listener组件的注册
1.创建一个类实现 ServletContextListener (具体实现哪个Listener根据情况来判断)
2.在类上加入注解 @WebListener
3.重写 contextInitialized() 与 contextDestroyed() 方法
4.编写启动类
5.增加注解 @ServletComponentScan
, 相关下载链接:
https://download.csdn.net/download/weixin_44609920/85787298?utm_source=bbsseo