title: Could not Autowired JobLauncherTestUtils in Spring-Batch
body: <p>I am getting below error while performing a functional test for a step in spring-batch .
  Getting below error:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.springframework.batch.test.JobLauncherTestUtils] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924)
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793)
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
  </code></pre>
  
  <p>Below is the configuration file and Test file used for this.</p>
  
  <p>custom-context.xml file:</p>
  
  <pre><code>&lt;batch:job id="custom.entities"&gt;
      &lt;batch:step id="entity.processor"&gt;
          &lt;batch:tasklet&gt;
              &lt;batch:chunk reader="customReader" writer="customWriter" commit-interval="1" /&gt;
          &lt;/batch:tasklet&gt;
      &lt;/batch:step&gt;
  &lt;/batch:job&gt;
  
  &lt;bean id="customReader" class="com.batch.custom.EntityReader" scope="step"&gt;
      &lt;property name="providerId" value="#{jobParameters['providerId']}" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="customWriter" class="org.springframework.batch.item.file.FlatFileItemWriter"&gt;
      &lt;property name="resource" value="file:c:/Temp/ledgers-output.txt"/&gt;
      &lt;property name="lineAggregator"&gt;
          &lt;bean class="org.springframework.batch.item.file.transform.PassThroughLineAggregator" /&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>CustomJobTest.java file</p>
  
  <pre><code>@Autowired
  private JobLauncherTestUtils jobLauncherTestUtils;
  
  @Autowired
  private ItemReader&lt;WatchlistDataSet&gt; reader;
  
  @Test
  @DirtiesContext
  public void testLaunchJob() throws Exception {
  
      JobParameters jobParameters = new JobParametersBuilder().addString("providerId", "cnp_1").toJobParameters();
  
      JobExecution exec = jobLauncherTestUtils.launchStep("entity.processor", jobParameters);
  
      assertEquals(BatchStatus.COMPLETED, exec.getStatus());
  
  }
  
  public JobLauncherTestUtils getJobLauncherTestUtils() {
      return jobLauncherTestUtils;
  }
  
  public void setJobLauncherTestUtils(JobLauncherTestUtils jobLauncherTestUtils) {
      this.jobLauncherTestUtils = jobLauncherTestUtils;
  }
  </code></pre>