Hello I'm trying to rewrite my old code to use Spring Boot.
I have one listener public class ExecutorListener implements ServletContextListener
.
How can I register this listener for Spring Boot?
I've tried:
@SpringBootApplication
@ComponentScan
public class Application extends SpringBootServletInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
servletContext.addListener(new ExecutorListener());
}
}
But the contextInitialized
method is not called.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…