title: Spring cannot import application-context from test package of different module
body: <p>I have a Java application that consists of two modules, ModuleA and ModuleB. </p>
  
  <p>In ModuleB's test context, applicationContextB-test.xml (see below), I try to import beans from the test context of ModuleA, applicationContextA-test.xml, like this:</p>
  
  <pre><code>&lt;import resource="classpath*:applicationContextA-test.xml"/&gt;
  </code></pre>
  
  <p>The beans in applicationContextA-test.xml can't be found, which results in exceptions when I run my unit tests in ModuleB:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanCreationException: Could not
    autowire field</p>
  </blockquote>
  
  <ul>
  <li><p>Intellij already indicates that applicationContextA-test.xml can't be found. </p></li>
  <li><p>Intellij also shows that applicationContextA.xml CAN be found.</p></li>
  <li><p>In the pom.xml of module B there is a dependency defined on ModuleA.</p></li>
  </ul>
  
  <p>Do you know why I am able to reference ModuleA's normal applicationContext, but not ModuleA's test application context?</p>
  
  <hr>
  
  <pre><code>/ModuleA
      /src/main/resources/
           - applicationContextA.xml
      /src/test/resources/
          - applicationContextA-test.xml
  
  pom.xml
  </code></pre>
  
  <hr>
  
  <pre><code>/ModuleB
      /src/main/resources/
           - applicationContextB.xml
      /src/test/resources/
          - applicationContextB-test.xml
  pom.xml
  </code></pre>