Dec 23rd, 2011, 02:41 AM
I've run into the same problem described above. Shouldn't the DispatchServlet register the WebApplicationContext.ROOT attribute with the ServletContext? It seems like a bug to me that DispatchServlet doesn't register this attribute especially if Spring Security DelegatingFilterProxy requires it.
Dec 23rd, 2011, 02:59 AM
No it shouldn't... The ROOT context (as also explained by the reference guide) is loaded by the ContextLoaderListener and NOT the DispatcherServlet. Imagine you have multiple DispatcherServlets, which servlet is the root context (trust me this isn't far fetched it is actually a situation I worked with next to some MessageDispatcherServlets).
Dec 24th, 2011, 01:28 AM
Thanks. I followed the steps you laid out for Aahzmandius and it worked. It was my mistake using DispatchServlet to load the full application. Correcting this also solved some other issues we had with multiple application contexts...
For other readers, steps followed:
1. Move application beans and config to service-context.xml
2. Setup ContextLoaderListener, in web.xml, with service-context.xml (the WebApplicationContext.ROOT)
3. Left Spring Web MVC config, including view config, in servlet-config.xml
4. Setup DispatchServlet, in web.xml, with servlet-config.xml
Tags for this Thread