I am trying to get the spring application context on a ServletContextListener. I am using Spring with annotation configuration. Using this code i get "context null". What I am doing wrong?
@WebListener
public class Initializer implements ServletContextListener
{
public void contextInitialized(ServletContextEvent event)
{
System.out.println("context " + WebApplicationContextUtils.getWebApplicationContext(event.getServletContext()));
}
@Override
public void contextDestroyed(ServletContextEvent sce)
{
}
}
Thanks
ContextLoaderListenershould be executed before this listener.