title: Spring Integration Test is Slow with Autowiring
body: <p>I am trying to speed up the Integration tests in our environment.  All our classes are autowired.  In our applicationContext.xml file we have defined the following:</p>
  
  <pre><code>&lt;context:annotation-config/&gt;
  &lt;context:component-scan base-package="com.mycompany.framework"/&gt;
  &lt;context:component-scan base-package="com.mycompany.service"/&gt;
  ...additional directories
  </code></pre>
  
  <p>I have noticed that Spring is scanning all directories indicated above and then iterates over each bean and caches the properties of each one.  (I went over the DEBUG messages from spring)</p>
  
  <p>As a result, the following test takes about 14 seconds to run:</p>
  
  <pre><code>public class MyTest extends BaseSpringTest {
    @Test
    def void myTest(){
      println "test"
    }
  }
  </code></pre>
  
  <p>Is there any way to lazy load the configuration?  I tried adding <code>default-lazy-init="true"</code> but that didn't work.</p>
  
  <p>Ideally, only the beans required for the test are instantiated.</p>
  
  <p>thanks in advance.</p>
  
  <p><strong>Update</strong>: I should have stated this before, I do not want to have a context file for each test.  I also do not think one context file for just the tests would work.  (This test context file would end up including everything)</p>