Improve the process of job registration

This commit changes the way of populating the default
job registry from using a BeanPostProcessor to using
a JobRegistrySmartInitializingSingleton. This change
resolves warnings about beans being eagerly injected
into currently created BeanPostProcessors and prevents
lifecycle issues about early bean initializations.

It also deprecates JobRegistryBeanPostProcessor in favor
of JobRegistrySmartInitializingSingleton.

Resolves #4547
This commit is contained in:
Mahmoud Ben Hassine
2024-03-22 15:40:52 +01:00
parent 692e7699c2
commit d9709ef954
7 changed files with 66 additions and 44 deletions

View File

@@ -222,7 +222,12 @@ example has been given an `id` so that it can be included in child
contexts (for example, as a parent bean definition) and cause all jobs created
there to also be registered automatically.
As of version 5.1, the `@EnableBatchProcessing` annotation automatically registers a `jobRegistryBeanPostProcessor` bean in the application context.
[WARNING]
.Deprecation
====
As of version 5.2, the `JobRegistryBeanPostProcessor` class is deprecated in favor of
`JobRegistrySmartInitializingSingleton`, see xref:#jobregistrysmartinitializingsingleton[JobRegistrySmartInitializingSingleton].
====
[[jobregistrysmartinitializingsingleton]]
=== JobRegistrySmartInitializingSingleton