-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
Warning message about bean post-processing and eager injection may suggest the wrong cause #33184
Comments
I encountered the same issue only after I have declared a @Configuration
@EnableWebSecurity
@EnableMethodSecurity(securedEnabled = true)
public class SpringSecurityConfiguration {
// other beans and securityFilterChain....
@Bean
public RoleHierarchy roleHierarchy() {
return RoleHierarchyImpl.fromHierarchy("ROLE_admin > ROLE_user");
}
} Almost all beans within IoC container complain about "The bean of type 'xxx' is not eligible for getting processed by all BeanPostProcessors.":
Any idea why the warning is raised? |
The only proper way out here is a combination That said, the warning message is incomplete indeed since it's not about injected dependencies but also abouter advisors to apply; I'll refine it for 6.1.14. |
Affects: 6.1
While looking at the sample for #33180 I noticed several warning messages related to eager injection and bean post-processing:
Each warning suggests that the declaration of
healthEndpointGroupsBeanPostProcessor
and its dependencies should be checked, but I don't think it's the culprit. In each case, the stack when the warning is logged is the following:It's finding eligible advisors that's causing the problem. This is happening through
AbstractAutoProxyCreator.postProcessAfterInitialization(Object, String)
that's called afterhealthEndpointGroupsBeanPostProcessor
has been created and initialized. The warnings can be reduced by marking the dependencies of the sample'sAdvisor
bean,authorizationManagerBeforeMethodInterception
, as@Lazy
:This reduces the warnings from five to two:
Is it possible to detect the case where
Advisor
beans are involved and point people in that direction?The text was updated successfully, but these errors were encountered: