title: Importing Spring beans from other Maven modules inside a WAR?
body: <p>I have a new web app that is packaged as a WAR as part of a multi-module Maven project.  The applicationContext.xml for this WAR references beans that are imported from the "service" module, which in turn imports beans from the "dao" module.  The import statement in applicationContext.xml looks like this:</p>
  
  <pre><code>&lt;import resource="classpath*:service.xml" /&gt;
  </code></pre>
  
  <p>and the one inside the service.xml file looks like this:</p>
  
  <pre><code>&lt;import resource="classpath*:dao.xml" /&gt;
  </code></pre>
  
  <p>Neither Spring STS, nor Eclipse show any warnings or errors in my bean files.  I reference the imported beans all over the place.   The Maven build works fine and the DAO integration tests all pass (they use the beans).  I don't have any service integration tests yet.  </p>
  
  <p>But when I start up the WAR in Jetty I get an error:</p>
  
  <pre><code>Error creating bean with name 'securityService' 
  Cannot resolve reference to bean 'userDAO' while setting constructor argument
  </code></pre>
  
  <p>All of the imported bean XML files can be found inside their respective JAR files in the WEB-INF/lib directory.  Indeed, the service bean that threw the error is itself defined inside the service.xml file inside the service module's JAR file.  </p>
  
  <p>Apparently the service module can't find the bean that it imported from the dao module.  Obviously I don't understand something...seems like this should this Just Work?</p>