Hi,
when you create a MVC project you have to define the Dispatcher-Servlet like this:
And the internal application-context like this:Code:<servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/webmvc-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>
My question is:Code:<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value> </context-param>
Why do we need different contexts here, one for the Dispatcher-Servlet and one for all the other beans?
How can I merge them into one? Should I?
I already tried to omit the contextConfigLocation in web.xml and use import in webmvc-config.xml instead, but this does not work.
Background of my question:
I have an applicationContext-aop.xml with common advices (tracing, logging etc) which should be used for the web-context and the internal context. I have worked around this problem by importing applicationContext-aop.xml in webmvc-config.xml, but this seems to be a bit strange because all my aop stuff is now loaded twice?
Thank you


Reply With Quote