Skip to content

Instantly share code, notes, and snippets.

@ghsyeung
Created February 22, 2012 17:45
Show Gist options
  • Save ghsyeung/1886275 to your computer and use it in GitHub Desktop.
Save ghsyeung/1886275 to your computer and use it in GitHub Desktop.
Webapp clean-up
public class ShutdownListener implements ServletContextListener {
@Override
public void contextDestroyed(ServletContextEvent sce) {
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext());
P p = (P) ctx.getBean("proc");
p.shutdown();
}
}
<listener>
<listener-class>com.example.html.events.ShutdownListener</listener-class>
</listener>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment