title: Creating bean in xml from another module not found
body: <p>I want to declare bean in xml like this:
  <code>&lt;bean  id="myClass" class="com.project.MyClass"/&gt;</code></p>
  
  <p>But when I run this then I get: <code>java.lang.ClassNotFoundException: com.project.MyClass</code></p>
  
  <p>Tried to add: <code>&lt;context:component-scan base-package="com.project"&gt;</code> but didn't help.</p>
  
  <p>What should I do to get the class as a bean?</p>
  
  <p>EDIT:<br>
  xml configuration:</p>
  
  <pre><code>@ContextConfiguration(locations = { "classpath:/applicationContext-test.xml" })
  </code></pre>
  
  <p>applicationContext-test:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
      xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:cxf="http://cxf.apache.org/core"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://www.springframework.org/schema/aop 
         http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
         http://www.springframework.org/schema/tx 
         http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
         http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"&gt;
  
      &lt;!-- setup properties file --&gt;
      &lt;context:property-placeholder location="classpath:application-test.properties" /&gt;
  
      &lt;!-- import spring context --&gt;
      &lt;import resource="classpath:META-INF/spring/springContext.xml" /&gt;
  
      &lt;import resource="classpath:META-INF/inMemoryH2Context.xml" /&gt;
  
      &lt;bean  id="myClass" class="com.project.MyClass"/&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>application-test.properties:</p>
  
  <pre><code>parameters... like for example: datasource.schema.prefix=eplcore.
  </code></pre>
  
  <p>META-INF/spring/springContext.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
      xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:jpa="http://www.springframework.org/schema/data/jpa"
      xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:cxf="http://cxf.apache.org/core"
      xsi:schemaLocation="http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://www.springframework.org/schema/aop 
         http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
         http://www.springframework.org/schema/tx 
         http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context-4.1.xsd
         http://www.springframework.org/schema/data/jpa
         http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
         http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"&gt;
  
      &lt;!-- spring context configuration --&gt;
  
      &lt;context:property-placeholder location="classpath:application.properties,classpath:scheduler.properties,classpath:batch-jobs.properties,classpath:oauth2-clients.properties" ignore-resource-not-found="true" /&gt;
  
      &lt;context:annotation-config /&gt;
      &lt;context:component-scan base-package="com.xxx"&gt;
          &lt;context:exclude-filter expression="com.xxx.Db2Dao" type="assignable" /&gt;
          &lt;context:exclude-filter expression="com.xxx.H2CDao" type="assignable" /&gt;
      &lt;/context:component-scan&gt;
  
      &lt;jpa:repositories base-package="com.repository" /&gt;
  
      &lt;!-- conditional cache context import --&gt;
      &lt;import resource="classpath:META-INF/spring/cache/springCache.xml" /&gt;
  
  &lt;/beans&gt;
  
  </code></pre>