title: Spring Batch Java Config JobLauncherTestUtils
body: <p>I am currently working on a spring boot project that uses spring batch. I am trying to use JavaConfig instead of xml but it's difficult with all of the docs currently in xml.</p>
  
  <p>I followed <a href="https://blog.codecentric.de/en/2013/06/spring-batch-2-2-javaconfig-part-5-modular-configurations" rel="noreferrer">https://blog.codecentric.de/en/2013/06/spring-batch-2-2-javaconfig-part-5-modular-configurations</a> but am having difficulties using the <code>JobLauncherTestUtils</code>. I know I need to tell the test to use the correct spring context, but I can't seem to figure out how to do it. I get the following error:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.batch.test.JobLauncherTestUtils' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  </code></pre>
  
  <p>My test looks like the following:</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest(classes = {MyApplication.class, MyJobConfiguration.class})
  public class RetrieveDividendsTest {
  
      @Autowired
      private JobLauncherTestUtils jobLauncherTestUtils;
  
      @Test
      public void testSomething() throws Exception {
          jobLauncherTestUtils.launchJob();
      }
  
  }
  </code></pre>