Skip to content

Auto-configure JobRegistryBeanPostProcessor with EnableBatchProcessing and DefaultBatchConfiguration #4245

Closed
@fmbenhassine

Description

@fmbenhassine

As of v4.3, @EnableBatchProcessing auto-configures a JobRegistry in the application context. So as a user, I still need to create a JobRegistryBeanPostProcessor bean myself to populate the registry:

@Bean
public JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor(JobRegistry jobRegistry) {
    JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor();
    postProcessor.setJobRegistry(jobRegistry);
    return postProcessor;
}

Since the JobRegistry is already created by @EnableBatchProcessing, this bean post processor could also be created by the annotation with the registry already set on it.

This also should apply to the programmatic way of configuration through DefaultBatchConfiguration introduced in v5.


References:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions