Skip to content

Cannot create asynchronous JobLauncher #1655

Closed
@ameraljovic

Description

@ameraljovic

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions