I want to create a bean that has start()
and stop()
methods.
When the webapp's context is active, start()
is called during Spring's runtime bootup. When the webapp is undeployed or stopped, the stop()
method is invoked.
Is this correct: I annotate my start()
method with @PostConstruct
and the stop()
method with @PreDestroy
?
Normally in the servlet world, I write a ServletContextListener. Would I be able to access the ApplicationContext from the ServletContextListener ?