title: Spring Batch Java Config @EnableBatchProcessing Annotation Error
body: <p>I'm using Spring Batch 2.2 with Spring 3. I'm trying to configure my job with Java config instead of the usual XML Config. Below is my AppConfig class :</p>
  
  <pre><code>@Configuration
  @EnableBatchProcessing
  public class AppConfig {
  
      @Autowired private JobBuilderFactory jobs;
      @Autowired private StepBuilderFactory steps;
      private Tasklet simpleTasklet = new SimpleTasklet();
  
      @Bean
      public Job job() {
          return jobs.get("myJob").start(step1(simpleTasklet)).build();
      }
  
      @Bean protected Step step1(Tasklet tasklet) {
          return steps.get("step1").tasklet(tasklet).build();
      }
  
  }
  </code></pre>
  
  <p>And runs it using this class below :</p>
  
  <pre><code>public class App {
      public static void main(String[] args) {
  
          ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
          JobLauncher jobLauncher = (JobLauncher)context.getBean("jobLauncher");
          Job job = (Job) context.getBean("myJob");
          try{
              JobExecution execution = jobLauncher.run(job, new JobParameters());
              System.out.println("Exit status : " + execution.getStatus());
          } catch (Exception e){
              e.printStackTrace();
          } 
      }
  
  }
  </code></pre>
  
  <p>It yields this error :</p>
  
  <pre><code>Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: org.springframework.batch.core.configuration.annotation.BatchConfigurationSelector was imported as a @Configuration class but was not actually annotated with @Configuration. Annotate the class or do not attempt to process it.
  Offending resource: class path resource [org/springframework/batch/core/configuration/annotation/BatchConfigurationSelector.class]
  </code></pre>
  
  <p>and the error stack points at this line :</p>
  
  <pre><code>ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
  </code></pre>
  
  <p>What am I doing wrong? Ideas anyone?</p>