Mongodb.core.ExecutableFindOperation не может быть разрешен

Я пишу пакет Spring, используя Spring boot. Читатель: следует читать из коллекции 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();
      }
  }

Может кто-нибудь подскажет, что не так в моей конфигурации?

Вот добавленные мной зависимости:

       spring-boot-starter-batch
       spring-boot-starter-data-mongodb
       spring-boot-starter-test
       lombok
       spring-batch-test

Какие версии вы используете?

Michael Minella 31.05.2018 15:50
Использование JavaScript и MongoDB
Использование JavaScript и MongoDB
Сегодня я собираюсь вкратце рассказать о прототипах в JavaScript, а также представить и объяснить вам работу с базой данных MongoDB.
0
1
323
1

Ответы 1

Я изменил свою версию spring-boot-starter-parent с 2.0.2.RELEASE на 2.0.1.RELEASE. Это решило мою проблему.

Другие вопросы по теме