Я пытаюсь создать тасклет и написать в couchbase.
@Configuration
@EnableBatchProcessing
public class BatchConfiguration extends
DefaultBatchConfigurer {
@Autowired
private JobBuilderFactory jobBuilders;
@Autowired
private StepBuilderFactory stepBuilders;
@Bean
public Step updatedatabaseStep(){
return stepBuilders.get("updatedatabaseStep").tasklet(new UpdateLocalDbStep()).build();}
Мой шаг
public class UpdateLocalDbStep implements Tasklet, StepExecutionListener {
@Autowired
private CouchBaseRepository
couchBaseRepository;
@Override
public RepeatStatus execute(StepContribution arg0, ChunkContext chunkContext) throws Exception {
couchBaseRepository.save(this.table);
return RepeatStatus.FINISHED;
}
My Couchbase service
@Repository
@N1qlPrimaryIndexed
@ViewIndexed(designDoc = "ownerDetails")
public class CouchBaseRepository {}
Каждый раз, когда я получаю исключение нулевого указателя при выполнении шага, заявляющего, что CouchBaseRepository имеет значение null
2018-11-12 18:59:10.435 INFO 56531 --- [
main] c.p.r.s.impl.steps.UpdateLocalDbStep
: Updating local db with lated table
info_incr
2018-11-12 18:59:10.440 ERROR 56531 --- [
main] o.s.batch.core.step.AbstractStep
: Encountered an error executing step
updatedatabaseStep in job findOwnerJob
java.lang.NullPointerException: null
at
com.restbatchApi.service.impl.steps.UpdateLocalDbStep.execute (UpdateLocalDbStep.java:58) ~ [classes /: na]
в
org.springframework.batch.core.step.tasklet.TaskletStep $ ChunkTransactionCallback.doInTransaction (TaskletStep.java:407) ~ [spring-batch-core-4.1.0.RELEASE.jar: 4.1.0.RELEASE]
в org.springframework.batch.core.step.tasklet.TaskletStep $ ChunkTransactionCallback.doInTransaction (TaskletStep.java:331) ~ [spring-batch-core-4.1.0.RELEASE.jar: 4.1.0.RELEASE]
в org.springframework.transaction.support.TransactionTemplate.execute (TransactionTemplate.java:140) ~ [spring-tx-5.1.2.RELEASE.jar: 5.1.2.RELEASE]