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

PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization WARNING after upgrade spring-framework-6.1.0 #4489

Open
leonchen83 opened this issue Nov 17, 2023 · 6 comments

Comments

@leonchen83
Copy link

leonchen83 commented Nov 17, 2023

Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description

23-11-17 16:19:16.578 WARN [main PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization:437]Bean 'batch.job.registry' of type [org.springframework.batch.core.configuration.support.MapJobRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor#0]? Check the corresponding BeanPostProcessor declaration and its dependencies.

Environment

spring-batch : 5.0.3
spring-framework : 6.1.0

Steps to reproduce

    <bean class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor">
        <property name="jobRegistry" ref="batch.job.registry" />
    </bean>

    <bean id="batch.job.registry" class = "org.springframework.batch.core.configuration.support.MapJobRegistry">
    </bean>

Expected behavior

no warning

Minimal Complete Reproducible example
Please provide a failing test or a minimal complete verifiable example that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

@mp911de
Copy link
Member

mp911de commented Nov 28, 2023

Duplicate of spring-projects/spring-data-jpa#3244 and spring-projects/spring-boot#38558.

We're not quite sure where this comes from.

@leonchen83
Copy link
Author

@mp911de
spring changed the log level in 6.1, before 6.1 this log is INFO level, after upgrade 6.1 this log changed to WARN

@hpoettker
Copy link
Contributor

The sudden attention comes from the changed log level from INFO to WARN: spring-projects/spring-framework#24092

The warnings are also logged with Java configuration (i.e. without XML) when the DefaultBatchConfiguration is used. The factory method for the JobRegistryBeanPostProcessor would ideally be static, as well as that for the MapJobRegistry, which the bean post processor depends on. But making this change would mean that the method can no longer be overridden which is how the DefaultBatchConfiguration is supposed to be extended.

@laywin
Copy link

laywin commented Jan 14, 2024

when declare a beanPostProcessor in xxAutoConfiguration. there will be a warn log for the xxAutoConfiguration. and the bbpsInCreation is empty. so the log message would like "..injected into a currently created BeanPostProcessor [] ? Check the corresponding BeanPostProcessor declaration and its dependencies.", which looks a little strange.

@philippn
Copy link

philippn commented Feb 22, 2024

As far as I understand, the org.springframework.batch.core.configuration.support.JobRegistrySmartInitializingSingleton was meant as a remediation of this warning. However, the fix is incomplete because org.springframework.batch.core.configuration.support.DefaultBatchConfiguration creates a JobRegistryBeanPostProcessor regardless of whether a bean of type org.springframework.batch.core.configuration.support.JobRegistrySmartInitializingSingleton exists or not.

Edit: The code snippet from here, fixes that.

@fmbenhassine
Copy link
Contributor

fmbenhassine commented Apr 8, 2024

@philippn There wasn't really a fix for these warnings in 5.1.1. The introduction of JobRegistrySmartInitializingSingleton was meant to provide a replacement for the JobRegistryBeanPostProcessor.

The proper fix for Java configuration is addressed in #4547, by replacing the BPP with the SIS in the default configuration.

For XML configuration as reported in this issue, the now deprecated JobRegistryBeanPostProcessor should be replaced with a JobRegistrySmartInitializingSingleton:

--<bean class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor">
++<bean class="org.springframework.batch.core.configuration.support.JobRegistrySmartInitializingSingleton">
        <property name="jobRegistry" ref="batch.job.registry" />
    </bean>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants