title: How to use SpringApplicationConfiguration or ContextConfiguration to load smaller app portions
body: <p>I am working on a spring-boot based project, which is fairly new to me. At present, I am using the @WebApplicationContext annotation to get any of my Junit test to run, as I cannot seem to get the application to boot any other way. My goal in asking this question is to either get a distinct answer to how to avoid it's use, or links to projects use an applicable concept.</p>
  
  <p>My exact goal is: I would like to have a testing configuration which will not load up the entire web application in order to test smaller services and sub sets of classes. </p>
  
  <p>Example:
  I currently have a series of 3 assemblers. One is for a parent object, and the other two for child related objects</p>
  
  <pre><code>@Component
  public class ReportResponseAssembler {
  
      @Autowired
      private ParameterResponseAssembler parameterResponseAssembler;
  
      @Autowired
      private TimeRangeResponseAssembler timeRangeResponseAssembler;
  
      public ReportResponseAssembler makeResponse() {
          return new ReportResponseAssembler();
      }
  }
  </code></pre>
  
  <p>For testing purposes, I would like to load up just these 3 classes and have them appropriately inject the dependencies into the parent. Something like:</p>
  
  <pre><code>public class ReportResponseAssemblerTest {
  
      @Autowired
      ReportInstanceResponseAssembler reportResponseAssembler;
  
      @Test
      public void testPlaceHolder() {
          Assert.assertNotNull(reportResponseAssembler);
      }
  }
  </code></pre>
  
  <p>I have attempted something along the lines of:</p>
  
  <pre><code>@EnableAutoConfiguration
  @ComponentScan(basePackages = { "com.blahpackage.service.assembler" })
  @Configuration
  public class TestContextConfiguration {}
  </code></pre>
  
  <p>Then feeding this to SpringApplicationConfiguration, but even with the scan it does not detect the applicable beans for auto injection. Perhaps I need to denote them as @Beans directly in the configuration and return new instances? Are there other good ways? Any links to example projects or explanations you have would be excellent.</p>
  
  <p>Thank you, any who respond, so much for your time.</p>