Skip to content

Auto-configure SimpleJobOperator with EnableBatchProcessing and DefaultBatchConfiguration #3941

Closed
@fmbenhassine

Description

@fmbenhassine

As of v4.3, @EnableBatchProcessing auto-configures all infrastructure beans except a JobOperator. So as a user, I still need to create a JobOperator bean myself like:

@Bean
public JobOperator jobOperator(JobLauncher jobLauncher, JobRegistry jobRegistry,
                               JobExplorer jobExplorer, JobRepository jobRepository) {
	SimpleJobOperator jobOperator = new SimpleJobOperator();
	jobOperator.setJobExplorer(jobExplorer);
	jobOperator.setJobLauncher(jobLauncher);
	jobOperator.setJobRegistry(jobRegistry);
	jobOperator.setJobRepository(jobRepository);
	return jobOperator;
}

Since all collaborators of the JobOperator (ie JobRepository, JobLauncher, JobRegistry, JobExplorer) are already created by @EnableBatchProcessing, this bean could also be created automatically by the annotation with those dependencies already set on it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions