title: Why does spring-ws not detect a spring configuration file if declared in the root context.
body: <p>I am having a weird problem. I have a my-spring.xml file i would like to add to application but for some reason i can only get it to be detected if it is in the root context. </p>
  
  <p>The following does not detect the my-spring.xml declared in the root context. </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
           version="2.4"&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
          /WEB-INF/my-datasources.xml
          /WEB-INF/my-spring.xml
          &lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;myservice&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.ws.transport.http.MessageDispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/webservice-config.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;myservice&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/webservice/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;mime-mapping&gt;
          &lt;extension&gt;wsdl&lt;/extension&gt;
          &lt;mime-type&gt;text/xml&lt;/mime-type&gt;
      &lt;/mime-mapping&gt;
  
      &lt;mime-mapping&gt;
          &lt;extension&gt;xsd&lt;/extension&gt;
          &lt;mime-type&gt;text/xml&lt;/mime-type&gt;
      &lt;/mime-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>If i change it to this then it works (Note the difference in the location of my-spring.xml).</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
           version="2.4"&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
          /WEB-INF/my-datasources.xml
          &lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;myservice&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.ws.transport.http.MessageDispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/webservice-config.xml&lt;/param-value&gt;
                  &lt;param-value&gt;/WEB-INF/my-spring.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;myservice&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/webservice/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;mime-mapping&gt;
          &lt;extension&gt;wsdl&lt;/extension&gt;
          &lt;mime-type&gt;text/xml&lt;/mime-type&gt;
      &lt;/mime-mapping&gt;
  
      &lt;mime-mapping&gt;
          &lt;extension&gt;xsd&lt;/extension&gt;
          &lt;mime-type&gt;text/xml&lt;/mime-type&gt;
      &lt;/mime-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>I cant really see what i am doing wrong. If i understood the way this works, when declared on the root context (as in the first example) it should be accessed by any resource throught the application. This does not seem to be the case in this example as i cant access the properties defined in the my-spring.xml file from the Controller/Endpoint class.</p>