Closed
Description
The Spring Boot implementations does not set any TaskExecutor
so it defaults to SyncTaskExecutor
. And there is no way (as I know) to override the default jobLauncher
bean because of this line in BasicBatchConfigurer
which creates a default jobLauncher
:
@PostConstruct
public void initialize() {
try {
this.transactionManager = createTransactionManager();
this.jobRepository = createJobRepository();
this.jobLauncher = createJobLauncher();
this.jobExplorer = createJobExplorer();
}
catch (Exception ex) {
throw new IllegalStateException("Unable to initialize Spring Batch", ex);
}
}
I also tried to autowire jobLauncher
and set the TaskExecutor
by myself. But because I can only autowire the interface, I can't call jobLauncher.setTaskExecutor(simpleAsyncTaskExecutor)
.