In servet class it's possible to get spring ApplicationContext
this way
ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
How to access ApplicationContext
in ServletContextListener
since getServletContext()
method is not accessible there?
In contextInitialized
:
public void contextInitialized(final ServletContextEvent event)
{
ApplicationContext appCtx = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
}