title: Can't Import applicationContext in test class
body: <p>my applicationContext.xml,webmvc-config.xml are in WEB-INF/spring/applicationContext.xml</p>
  
  <p>when i try the following, it doesn't load, and i get <code>java.io.FileNotFoundException</code></p>
  
  <pre><code>@ContextConfiguration(locations = { "classpath:WEB-INF/spring/applicationContext.xml" })
  </code></pre>
  
  <p>i am using spring 3, junit 4.7.</p>
  
  <p>it works with the dirty workaround by copying applicationContext.xml in resources folder, so it's duplicated.</p>
  
  <p>and i changed the loading to:</p>
  
  <pre><code>@ContextConfiguration(locations = { "classpath:/applicationContext.xml" })
  </code></pre>
  
  <p>my web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"&gt;
  
    &lt;!-- start up and shut down Spring's root WebApplicationContext (Interface to provide configuration for a web application) --&gt;
    &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
    &lt;/listener&gt;
  
    &lt;!-- Central dispatcher for HTTP request handlers/controllers: take an incoming URI and find the right combination of handlers (generally methods on Controller classes) 
    and views (generally JSPs) that combine to form the page or resource that's supposed to be found at that location. --&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;p&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
        &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
        &lt;param-value&gt;
              /WEB-INF/spring/webmvc-config.xml                       
              &lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;p&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/p/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
    &lt;!-- allows one to specify a character encoding for requests. 
    This is useful because current browsers typically do not set a character encoding even if specified in the HTML page or form --&gt;
    &lt;filter&gt;
      &lt;filter-name&gt;encoding-filter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;
      &lt;init-param&gt;
        &lt;param-name&gt;encoding&lt;/param-name&gt;
        &lt;param-value&gt;utf-8&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
        &lt;param-name&gt;forceEncoding&lt;/param-name&gt;
        &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/init-param&gt;
    &lt;/filter&gt;
  
    &lt;filter-mapping&gt;
      &lt;filter-name&gt;encoding-filter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
      &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
    &lt;/filter-mapping&gt;
  
    &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
        /WEB-INF/spring/applicationContext.xml
      &lt;/param-value&gt;
    &lt;/context-param&gt;
  
    &lt;!--  
    &lt;filter&gt;
    &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; 
    &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; 
    &lt;/filter&gt;
  
   &lt;filter-mapping&gt;
    &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; 
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt; 
    &lt;/filter-mapping&gt;  
    --&gt;
  
  
    &lt;!-- Based on the popular and very useful mod_rewrite for apache, UrlRewriteFilter is a Java Web Filter for any J2EE
         compliant web application server (such as Resin or Tomcat), which allows you to rewrite URLs before they get to your
         code. It is a very powerful tool just like Apache's mod_rewrite. --&gt;
    &lt;filter&gt;
    &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt; 
    &lt;filter-class&gt;org.tuckey.web.filters.urlrewrite.UrlRewriteFilter&lt;/filter-class&gt;
    &lt;/filter&gt;
  
    &lt;filter-mapping&gt;
    &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt; 
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt; 
    &lt;/filter-mapping&gt;
  
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>please advise a better solution.</p>