如果在启动项目的时候做一些事情可以使用 ServletContextListener 监听器
编写类 实现接口 ServletContextListener 重写 public void contextInitialized(ServletContextEvent sce) {}方法即可;
在springboot中 在编写的类上使用注解 @WebListener 在启动类上使用 @ServletComponentScan 即可(注解不唯一);
ServletContextListener
最新推荐文章于 2020-07-07 14:28:36 发布
258

被折叠的 条评论
为什么被折叠?



