spring-cloud / spring-cloud-commons

Common classes used in different Spring Cloud implementations
Apache License 2.0
701 stars 697 forks source link

Bean is not eligible for getting processed by all BeanPostProcessors #1332

Closed JaroslawDembek closed 5 months ago

JaroslawDembek commented 6 months ago

After migration to: spring-cloud-commons/loadbalancer:4.1.0 spring-boot:3.2.2 spring-webflux:6.1.3 from: spring-cloud-commons/loadbalancer:4.0.4 spring-boot:3.1.8 spring-webflux:6.0.16

We experience many warnings for different beans from: logger:"o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker" Some examples: Bean 'reactorDeferringLoadBalancerExchangeFilterFunction' of type [org.springframework.cloud.client.loadbalancer.reactive.DeferringLoadBalancerExchangeFilterFunction] 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 [loadBalancerWebClientBuilderBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.

Bean 'defaultsBindHandlerAdvisor' of type [org.springframework.cloud.commons.config.DefaultsBindHandlerAdvisor] 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 [lbRestClientPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.

General funtionality of loadbalancer is intact.

I believe it is continuation of: https://github.com/spring-cloud/spring-cloud-commons/issues/1246 It is a little bit like Spring-Cloud goes against Spring. At first it looks like app problem when one use bean post processing. These kind of warnings are for a reason - ignoring them could lead to issues that are very, very hard to debug. IMO ignoring this, and I reckon adding new warnings (RestClient) is a risky direction.

OlgaMaciaszek commented 6 months ago

Hello @JaroslawDembek, thanks for reporting the issue. It won't be there any longer for RestClient. We've changed the implementation from 4.1.1. When it comes to the DeferringLoadBalancerExchangeFilterFunction, the warning just informs, it's not eligible for auto-proxying. For that function, we don't need it to be.

spring-cloud-issues commented 6 months ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues commented 5 months ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

ichenfeng commented 4 months ago

[WARN ] [2024-04-15 15:11:22.900] [main] [o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:429] - Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration$DeferringLoadBalancerInterceptorConfig' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration$DeferringLoadBalancerInterceptorConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [lbRestClientPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead. [WARN ] [2024-04-15 15:11:22.906] [main] [o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437] - Bean 'deferringLoadBalancerInterceptor' of type [org.springframework.cloud.client.loadbalancer.DeferringLoadBalancerInterceptor] 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 [lbRestClientPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.

OlgaMaciaszek commented 4 months ago

Yes, that's just a warning. We are aware of it. We do not want this bean to be further post-processed.