<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:config/applicationContext.xml</param-value>
</context-param>
You must have a listener defined as this:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
This ContextLoaderListener
listener is responsible for starting and stopping the Spring root ApplicationContext
interface, which loads the beans defined in applicationContext.xml
. It finds the configurations to be used by looking at the <context-param>
tag for contextConfigLocation
.
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:config/spring-ws-servlet.xml</param-value>
</init-param>
</servlet>
The ApplicationContext
created by DispatcherServlet
is a child of the root ApplicationContext
interface. Typically, Spring MVC-specific components
are initialized in the ApplicationContext interface of DispatcherServlet, while
the rest are loaded by ContextLoaderListener
.
The beans in a child ApplicationContext
(such as those created by DispatcherServlet) can refer to beans of its parent ApplicationContext (such as those created by ContextLoaderListener). However, the parent ApplicationContext
cannot refer to beans of the child ApplicationContext
.