Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JobRegistrySmartInitializingSingleton #4521

Closed

Conversation

hpoettker
Copy link
Contributor

@hpoettker hpoettker commented Dec 18, 2023

This PR adds JobRegistrySmartInitializingSingleton as an alternative to JobRegistryBeanPostProcessor. Using JobRegistrySmartInitializingSingleton instead of JobRegistryBeanPostProcessor allows users to solve problems like #4489, where they configure their own application context and want a mechanism to automatically register job beans with the job registry.

As also discussed in #4520, the advantage of JobRegistrySmartInitializingSingleton over JobRegistryBeanPostProcessor is that it is not prone to trigger early initializations of beans.

One other difference is that JobRegistrySmartInitializingSingleton will instantiate all job beans that are declared as lazy (unless the property allowEagerClassLoading of DefaultListableBeanFactory is set to false). This shouldn't be a problem however as users who do use the JobRegistry are very unlikely to have lazily initialized job beans as that would imply that the JobRegistry is incomplete.

fmbenhassine added a commit that referenced this pull request Feb 6, 2024
- Update reference documentation
- Minor test updates
@fmbenhassine
Copy link
Contributor

LGTM. Rebased and merged as fe26d00, I just refined some tests and updated the reference docs (see d6b6361).

I couldn't find a backward compatible fix, but this will be available in 5.1.1 as a replacement of the BPP. I planned the switch to the SIS for 5.2 (#4547).

Again, thank you very much for your continuous contributions, really appreciated!

@fmbenhassine fmbenhassine added this to the 5.1.1 milestone Feb 6, 2024
@hpoettker hpoettker deleted the smart-initializing-singleton branch February 6, 2024 17:36
fmbenhassine added a commit that referenced this pull request Feb 7, 2024
- Update reference documentation
- Minor test updates

(cherry picked from commit d6b6361)
@fmbenhassine fmbenhassine modified the milestones: 5.1.1, 5.2.0 Feb 7, 2024
@fmbenhassine fmbenhassine added the for: backport-to-5.1.x Issues that will be back-ported to the 5.1.x line label Feb 7, 2024
@fmbenhassine fmbenhassine modified the milestones: 5.2.0, 5.2.0-M1 Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: backport-to-5.1.x Issues that will be back-ported to the 5.1.x line in: core pr-for: feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants