无法解析mongodb.core.ExecutableFindOperation

无法解析mongodb.core.ExecutableFindOperation,mongodb,spring-boot,spring-batch,Mongodb,Spring Boot,Spring Batch,我正在使用SpringBoot编写Spring批处理。 读卡器:它应该从Mongo DB集合中读取 作者:只需打印一些信息 但我在运行批处理时遇到以下异常: s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreation

我正在使用SpringBoot编写Spring批处理。 读卡器:它应该从Mongo DB集合中读取 作者:只需打印一些信息

但我在运行批处理时遇到以下异常:

s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchConfig' defined in file [C:\Workspace\batch\target\classes\com\myproject\batch\config\BatchConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.myproject.batch.config.BatchConfig$$EnhancerBySpringCGLIB$$8c3acbde]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems: 
The type org.springframework.data.mongodb.core.ExecutableFindOperation cannot be resolved. It is indirectly referenced from required .class files
The type org.springframework.data.mongodb.core.ExecutableRemoveOperation$ExecutableRemove cannot be resolved. It is indirectly referenced from required .class files
The type org.springframework.data.mongodb.core.ExecutableAggregationOperation cannot be resolved. It is indirectly referenced from required .class files
The type org.springframework.data.mongodb.core.ExecutableAggregationOperation$TerminatingAggregation cannot be resolved. It is indirectly referenced from required .class files
The type org.springframework.data.mongodb.core.ExecutableInsertOperation$ExecutableInsert cannot be resolved. It is indirectly referenced from required .class files
这是我的密码:

@EnableBatchProcessing
@Configuration
public class BatchConfig {

      @Autowired
      private JobBuilderFactory jobBuilderFactory;
      @Autowired
      private StepBuilderFactory stepBuilderFactory;
      @Autowired
      private MongoTemplate mongoTemplate;

      @Bean
      public Job job() {
          return jobBuilderFactory.get("job").flow(step1()).end().build();
      }

      @Bean
      public MongoItemReader<Report> reader() {
          MongoItemReader<Report> reader = new MongoItemReader<>();
          reader.setTemplate(mongoTemplate);
          reader.setSort(new HashMap<String, Sort.Direction>() {
              {
            put("_id", Direction.DESC);
              }
          });
          reader.setTargetType(Report.class);
          reader.setQuery("{}");
          return reader;
      }

      @Bean
      public ItemWriter<String> writer() {
          System.out.println("#Writer Step:");
      }

      @Bean
      public Step step1() {
          return stepBuilderFactory.get("step1").<String,       String>chunk(1).reader(reader()).writer(writer()).build();
      }
  }

我将SpringBootStarter父版本从2.0.2.RELEASE更改为2.0.1.RELEASE。这解决了我的问题。

您使用的是什么版本?
       spring-boot-starter-batch
       spring-boot-starter-data-mongodb
       spring-boot-starter-test
       lombok
       spring-batch-test