Skip to content

Instantly share code, notes, and snippets.

@danilat
Created January 27, 2009 23:30
Show Gist options
  • Save danilat/53639 to your computer and use it in GitHub Desktop.
Save danilat/53639 to your computer and use it in GitHub Desktop.
private ApplicationContext getApplicationContext(HttpSessionEvent event){
ServletContext servletContext = event.getSession().getServletContext();
ApplicationContext context = (ApplicationContext) servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
return context;
}
public void sessionCreated(HttpSessionEvent event) {
TestService testService = (TestService) getApplicationContext(event).getBean("testService");
//....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment