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

BeanPostProcessors not registered correctly when @LoadBalanced bean instantiated in auto-configuration #1315

Closed
ZIRAKrezovic opened this issue Dec 18, 2023 · 34 comments · Fixed by #1319
Assignees
Labels
Milestone

Comments

@ZIRAKrezovic
Copy link

Describe the bug

Spring Cloud 2023.0.0, Spring Boot 3.2.0

On application startup, I see the messages such as:

2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration$LoadBalancerInterceptorConfig' of type [org.springframework.cloud.client.loa
dbalancer.LoadBalancerAutoConfiguration$LoadBalancerInterceptorConfig] 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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration' of type [org.springframework.cloud.loadbalancer.config.Blocki
ngLoadBalancerClientAutoConfiguration] 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 declaratio
n and its dependencies.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration' of type [org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConf
iguration] 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.     
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration' of type [org.springframework.cloud.commons.config.CommonsConfigAutoConfiguratio
n] 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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration' of type [org.springframework.cloud.client.loadbalanc
er.LoadBalancerDefaultMappingsProviderAutoConfiguration] 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 BeanPostPr
ocessor declaration and its dependencies.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerClientsDefaultsMappingsProvider' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration
$$Lambda/0x0000026884577470] 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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'defaultsBindHandlerAdvisor' of type [org.springframework.cloud.commons.config.DefaultsBindHandlerAdvisor] is not eligible for getting processed by all B
eanPostProcessors (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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'spring.cloud.loadbalancer-org.springframework.cloud.client.loadbalancer.LoadBalancerClientsProperties' of type [org.springframework.cloud.client.loadbal
ancer.LoadBalancerClientsProperties] 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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'default.org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration.LoadBalancerClientSpecification' of type [org.springframework.cloud.
loadbalancer.annotation.LoadBalancerClientSpecification] 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 BeanPostPr
ocessor declaration and its dependencies.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'default.org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration.LoadBalancerClientSpecification' of type [org.springfr
amework.cloud.loadbalancer.annotation.LoadBalancerClientSpecification] 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 correspond
ing BeanPostProcessor declaration and its dependencies.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'default.org.springframework.cloud.netflix.eureka.loadbalancer.LoadBalancerEurekaAutoConfiguration.LoadBalancerClientSpecification' of type [org.springfr
amework.cloud.loadbalancer.annotation.LoadBalancerClientSpecification] 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 correspond
ing BeanPostProcessor declaration and its dependencies.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerClientFactory' of type [org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory] is not eligible for getting processed by a
ll 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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'blockingLoadBalancerClient' of type [org.springframework.cloud.loadbalancer.blocking.client.BlockingLoadBalancerClient] is not eligible for getting proc
essed 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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerServiceInstanceCookieTransformer' of type [org.springframework.cloud.loadbalancer.core.LoadBalancerServiceInstanceCookieTransformer] 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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'xForwarderHeadersTransformer' of type [org.springframework.cloud.loadbalancer.blocking.XForwardedHeadersTransformer] is not eligible for getting process
ed 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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConf
iguration] 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.     
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerRequestFactory' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerRequestFactory] 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.
2023-12-18 12:47:11  WARN 21972 --- [ua] [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerInterceptor' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor] is not eligible for getting processed by all Be
anPostProcessors (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.

This can break other beans that this post-processor handles, such as RestTemplates produced by Auto Configuration.

Offending class seems to be: https://github.com/spring-cloud/spring-cloud-commons/blob/main/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerAutoConfiguration.java

And offending bean(s) can be either one of:

https://github.com/spring-cloud/spring-cloud-commons/blob/main/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerAutoConfiguration.java#L106

https://github.com/spring-cloud/spring-cloud-commons/blob/main/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerAutoConfiguration.java#L179

According to the log, they should have static qualifier in their definition.

@viktor-sava
Copy link

viktor-sava commented Dec 22, 2023

I faced the same problem while developing my application. Spring Boot 3.2.0. Spring Cloud 2023.0.0.

trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration$LoadBalancerInterceptorConfig' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration$LoadBalancerInterceptorConfig] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration' of type [org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration' of type [org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration' of type [org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerClientsDefaultsMappingsProvider' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration$$Lambda/0x0000014bd738fc58] 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.
trationDelegate$BeanPostProcessorChecker : 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.
trationDelegate$BeanPostProcessorChecker : Bean 'spring.cloud.loadbalancer-org.springframework.cloud.client.loadbalancer.LoadBalancerClientsProperties' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerClientsProperties] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'default.org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration.LoadBalancerClientSpecification' of type [org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientSpecification] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'default.org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration.LoadBalancerClientSpecification' of type [org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientSpecification] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'default.org.springframework.cloud.netflix.eureka.loadbalancer.LoadBalancerEurekaAutoConfiguration.LoadBalancerClientSpecification' of type [org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientSpecification] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerClientFactory' of type [org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'blockingLoadBalancerClient' of type [org.springframework.cloud.loadbalancer.blocking.client.BlockingLoadBalancerClient] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerServiceInstanceCookieTransformer' of type [org.springframework.cloud.loadbalancer.core.LoadBalancerServiceInstanceCookieTransformer] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'xForwarderHeadersTransformer' of type [org.springframework.cloud.loadbalancer.blocking.XForwardedHeadersTransformer] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerRequestFactory' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerRequestFactory] 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.
trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerInterceptor' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor] 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.

@viktordiktor
Copy link

Same problem

@CodingDochi
Copy link

me too

@leeaee
Copy link

leeaee commented Dec 26, 2023

mee too

@krezovic
Copy link

There is an open PR that will hopefully fix this #1304

@haidiiii
Copy link

haidiiii commented Dec 27, 2023

here is my logs:

2023-12-27 15:50:52.127  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration' of type [org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration] 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.
2023-12-27 15:50:52.132  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration' of type [org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration] 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.
2023-12-27 15:50:52.152  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration' of type [org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration] 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.
2023-12-27 15:50:52.157  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration] 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.
2023-12-27 15:50:52.160  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerClientsDefaultsMappingsProvider' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration$$Lambda/0x0000022a81694cc8] 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.
2023-12-27 15:50:52.171  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : 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.
2023-12-27 15:50:52.254  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.cloud.loadbalancer-org.springframework.cloud.client.loadbalancer.LoadBalancerClientsProperties' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerClientsProperties] 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.
2023-12-27 15:50:52.271  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'default.org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration.LoadBalancerClientSpecification' of type [org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientSpecification] 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.
2023-12-27 15:50:52.273  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'default.org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration.LoadBalancerClientSpecification' of type [org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientSpecification] 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.
2023-12-27 15:50:52.275  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerClientFactory' of type [org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory] 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.
2023-12-27 15:50:52.293  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'blockingLoadBalancerClient' of type [org.springframework.cloud.loadbalancer.blocking.client.BlockingLoadBalancerClient] 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.
2023-12-27 15:50:52.312  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerServiceInstanceCookieTransformer' of type [org.springframework.cloud.loadbalancer.core.LoadBalancerServiceInstanceCookieTransformer] 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.
2023-12-27 15:50:52.316  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'xForwarderHeadersTransformer' of type [org.springframework.cloud.loadbalancer.blocking.XForwardedHeadersTransformer] 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.
2023-12-27 15:50:52.319  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration] 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.
2023-12-27 15:50:52.337  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerRequestFactory' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerRequestFactory] 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.
2023-12-27 15:50:52.342  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration$BlockingLoadBalancerRetryConfig' of type [org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration$BlockingLoadBalancerRetryConfig$$SpringCGLIB$$0] 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.
2023-12-27 15:50:52.352  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancedRetryFactory' of type [org.springframework.cloud.loadbalancer.blocking.retry.BlockingLoadBalancedRetryFactory] 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.
2023-12-27 15:50:52.366  WARN 50848 --- [simple2] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerInterceptor' of type [org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor] 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.

Padi-owasp added a commit to The-OAG-Development-Project/Application-Gateway that referenced this issue Dec 27, 2023
- Updated To Spring-Cloud 2023.0.0
- Spdated To Spring Boot 3.2.1
- dependency Updates to fix security issues
- Fixed an issue with Secondary Trace-Header (where in the simple trace case an invalid header of "n/a" was tried to be added to downstream requests.
- (new WARN log entries of Type: "...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..." are related to SpringBoot 3.2.1 and an known issue (spring-cloud/spring-cloud-commons#1315)
-
Fixing dependencies / vulnerabilities
@OlgaMaciaszek OlgaMaciaszek self-assigned this Jan 11, 2024
@OlgaMaciaszek
Copy link
Collaborator

Hello @ZIRAKrezovic, thanks for reporting the issue. This is just a warning so that the developer know certain beans are not being post-processed. In the case of those beans it should not cause issues; @ZIRAKrezovic @viktor-sava @viktordiktor @Dev-Hammy @haidiiii if it's causing actual issues, please provide a minimal, complete, verifiable example that reproduces the issue.

@ZIRAKrezovic
Copy link
Author

ZIRAKrezovic commented Jan 11, 2024

I'll provide detailed example later, but my problem was the following

  • Define RestTemplate @bean via @autoConfiguration and accept RestTemplateBuilder as a parameter to producer method
  • ObservationRegistryPostProcessor rendered invalid as ObservationRegistry used by RestTemplateBuilder "was no longer eligible for post processing" as it uses a post processor to configure observers
  • No observation functionality anymore

@OlgaMaciaszek
Copy link
Collaborator

Ok, thanks for the information. Will wait for the sample.

@ZIRAKrezovic
Copy link
Author

https://github.com/ZIRAKrezovic/spring-cloud-reproducer

@AutoConfiguration(after = RestTemplateAutoConfiguration.class)
@ConditionalOnBean(RestTemplateBuilder.class)
@ConditionalOnClass({RestTemplateBuilder.class, RestTemplate.class, LoadBalancerClient.class})
public class ProjectRestTemplateAutoConfiguration {
    @Bean
    @LoadBalanced
    public RestTemplate projectRestTemplate(RestTemplateBuilder builder) {
        return builder.build();
    }
}

image

Half of spring boot is broken when you define a @loadbalancer RestTemplate @bean inside @autoConfiguration class.

@OlgaMaciaszek
Copy link
Collaborator

Thanks for the sample @ZIRAKrezovic, will take a look. Also, could you please let us know why you're trying to instantiate the @LoadBalanced bean in an auto-configuration as opposed to a standard configuration class (not something we've seen the users do before)? Do you have a specific scenario that requires it?

@ZIRAKrezovic
Copy link
Author

I have 20 microservices using @LoadBalanced REST template, every of them defines it differently. To introduce observability, it is important to create RestTemplate from RestTemplateBuilder provided by Spring Boot auto configuration. The snippet from above is part of a library shared between them. @configuration does not work in libraries well ...

@OlgaMaciaszek OlgaMaciaszek changed the title BeanPostProcessor [lbRestClientPostProcessor] is declared through a non-static factory method on that class BeanPostProcessors not registered correctly when @LoadBalanced bean instantiated in auto-configuration Jan 11, 2024
@OlgaMaciaszek
Copy link
Collaborator

Thanks, @ZIRAKrezovic, I was able to reproduce the issue. The problem is not the non-static definition, but the fact that during bean postprocessing it's too early to access the LBInterceptor if a @LoadBalanced bean is created from an auto-configuration. Will fix it.

@github-project-automation github-project-automation bot moved this from In Progress to Done in 2023.0.1 Jan 16, 2024
@ZIRAKrezovic
Copy link
Author

Hi @OlgaMaciaszek, sorry to bump this thread. When is the 2023.0.1 release planned? I only see 2022.0.5 release on https://calendar.spring.io/ that's planned some time next week

@OlgaMaciaszek
Copy link
Collaborator

@ZIRAKrezovic it's scheduled for 20th Feb, but I'd like to release just the new Commons version early next week to make this fix available.

@OlgaMaciaszek
Copy link
Collaborator

@ZIRAKrezovic here it is: https://spring.io/blog/2024/01/23/spring-cloud-commons-4-1-1-has-been-released/

@ZIRAKrezovic
Copy link
Author

@OlgaMaciaszek thanks for the heads up and the effort to get this released!

@piotrszczepankowski
Copy link

piotrszczepankowski commented Jan 24, 2024

@OlgaMaciaszek do you plan also to bump version and release spring-cloud-dependencies?

@OlgaMaciaszek
Copy link
Collaborator

Hello @piotrszczepankowski, not really - that release is scheduled for 20th Feb. You'll need to update it manually in your build file till the new version of the entire release train is released.

@piotrszczepankowski
Copy link

piotrszczepankowski commented Feb 1, 2024

@OlgaMaciaszek we still have this error on one bean after bumping version of spring cloud commons:

 WARN  [o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker] - Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [annotationActionEndpointMapping] is declared through a non-static factory method on that class; consider declaring it as static instead.

Could it be related to the same issue?

@OlgaMaciaszek
Copy link
Collaborator

Hello @piotrszczepankowski this does not seem to be related.

@kmandalas
Copy link

kmandalas commented Feb 18, 2024

@OlgaMaciaszek does this issue have a side-effect or its simply a WARN? I also receive such logs for project under migration from Spring Boot 2.x to 3.2.2 and Spring Cloud 2021.0.3 to 2023.0.0

@OlgaMaciaszek
Copy link
Collaborator

@kmandalas There should be a WARN for the classes related to some of the load-balancer post-processing, and that's by desing; there was a different issue which caused other classes not to be post-processed properly when @LoadBalanced bean were created in an auto-configuration, along with a warning for each. If you're migrating, please manually set Spring Cloud Commons version to 4.1.1 to avoid any issues, as it contains the bugfix. Once Spring Cloud 2023.0.1 is released and you switch to it, remove the manually set Commons version.

@stefan-g
Copy link

@OlgaMaciaszek I updated spring cloud commons to 4.1.1 but still got the following warnings:

trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [loadBalancerWebClientBuilderBeanPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead.
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig] 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.
trationDelegate$BeanPostProcessorChecker : 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.

should that be fixed in this version?

@OlgaMaciaszek
Copy link
Collaborator

@stefan-g That issue has already been fixed in 4.1.1. These warnings are by design - we don't want the LB-postprocessing-related beans to be further post-processed; the issue was that some other beans were not being post-processed correctly; this should be fixed. Please get back to us if you observe an actual issue in functioning of the configuration and not the warning.

@verbitan
Copy link

verbitan commented Mar 1, 2024

Hi @OlgaMaciaszek - Apologies in advance if I'm misunderstanding you, but could you clarify what I'm seeing below is expected behaviour? I feel like Spring Cloud shouldn't throw warnings out of the box.

I have the following basic pom.xml for a Spring Cloud Gateway application using Spring Cloud 2023.0.0 and manually upgrading spring-cloud-commons to 4.1.1 as you describe.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.3</version>
    <relativePath />
  </parent>

  <groupId>com.example.issue</groupId>
  <artifactId>cloud-gateway-load-balancer-warnings</artifactId>
  <version>develop</version>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>2023.0.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-commons</artifactId>
      <version>4.1.1</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-gateway</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-loadbalancer</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
</project>

I then have two very simple files to ensure the application will run.

src/main/java/com/example/issue/CloudGatewayApplication.java

package com.example.issue;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class CloudGatewayApplication {

    public static void main(final String[] args) {
        SpringApplication.run(CloudGatewayApplication.class, args);
    }
}

src/main/resources/application.yml

server:
  port: 8080

spring:
  cloud:
    gateway:
      routes:
        - id: TestRoute
          uri: https://example.com
          predicates:
            - Path=/**

If I then run the application via mvn clean spring-boot:run it reports three warnings as described by @stefan-g above.

[INFO] Scanning for projects...
[INFO]
[INFO] -------< com.example.issue:cloud-gateway-load-balancer-warnings >-------
[INFO] Building cloud-gateway-load-balancer-warnings develop
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.3.2:clean (default-clean) @ cloud-gateway-load-balancer-warnings ---
[INFO] Deleting /tmp/SpringIssue/target
[INFO]
[INFO] >>> spring-boot:3.2.3:run (default-cli) > test-compile @ cloud-gateway-load-balancer-warnings >>>
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ cloud-gateway-load-balancer-warnings ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] Copying 0 resource from src/main/resources to target/classes
[INFO]
[INFO] --- compiler:3.11.0:compile (default-compile) @ cloud-gateway-load-balancer-warnings ---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 1 source file with javac [debug release 17] to target/classes
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ cloud-gateway-load-balancer-warnings ---
[INFO] skip non existing resourceDirectory /tmp/SpringIssue/src/test/resources
[INFO]
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ cloud-gateway-load-balancer-warnings ---
[INFO] No sources to compile
[INFO]
[INFO] <<< spring-boot:3.2.3:run (default-cli) < test-compile @ cloud-gateway-load-balancer-warnings <<<
[INFO]
[INFO]
[INFO] --- spring-boot:3.2.3:run (default-cli) @ cloud-gateway-load-balancer-warnings ---
[INFO] Attaching agents: []

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.3)

2024-03-01T12:08:52.302Z  INFO 32621 --- [           main] c.example.issue.CloudGatewayApplication  : Starting CloudGatewayApplication using Java 17.0.7 with PID 32621 (/tmp/SpringIssue/target/classes started by njames in /tmp/SpringIssue)
2024-03-01T12:08:52.308Z  INFO 32621 --- [           main] c.example.issue.CloudGatewayApplication  : No active profile set, falling back to 1 default profile: "default"
2024-03-01T12:08:54.061Z  INFO 32621 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=97ccfdb0-3f3f-309c-91e5-6bb12942c484
2024-03-01T12:08:54.195Z  WARN 32621 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [loadBalancerWebClientBuilderBeanPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead.
2024-03-01T12:08:54.197Z  WARN 32621 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig] 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.
2024-03-01T12:08:54.199Z  WARN 32621 --- [           main] trationDelegate$BeanPostProcessorChecker : 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.
2024-03-01T12:08:55.462Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [After]
2024-03-01T12:08:55.462Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Before]
2024-03-01T12:08:55.462Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Between]
2024-03-01T12:08:55.463Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Cookie]
2024-03-01T12:08:55.463Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Header]
2024-03-01T12:08:55.463Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Host]
2024-03-01T12:08:55.463Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Method]
2024-03-01T12:08:55.463Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Path]
2024-03-01T12:08:55.463Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Query]
2024-03-01T12:08:55.463Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [ReadBody]
2024-03-01T12:08:55.464Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [RemoteAddr]
2024-03-01T12:08:55.464Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [XForwardedRemoteAddr]
2024-03-01T12:08:55.464Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Weight]
2024-03-01T12:08:55.464Z  INFO 32621 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [CloudFoundryRouteService]
2024-03-01T12:08:55.847Z  INFO 32621 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'
2024-03-01T12:08:56.254Z  WARN 32621 --- [           main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
2024-03-01T12:08:56.528Z  INFO 32621 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port 8080
2024-03-01T12:08:56.696Z  INFO 32621 --- [           main] c.example.issue.CloudGatewayApplication  : Started CloudGatewayApplication in 5.201 seconds (process running for 5.836)

@OlgaMaciaszek
Copy link
Collaborator

Yes, @verbitan - this is a warning thrown by Spring Boot. It's not an error - it's just making sure it's known that these two beans will not be further post-processed, which is fine.

@verbitan
Copy link

verbitan commented Mar 1, 2024

Ok thanks @OlgaMaciaszek for confirming. We currently monitor for and raise production alerts for any WARN messages showing in our log file, we treat WARN as 'a bad thing happened, but not as bad as an ERROR, so mark it lower priority'.

Sounds like we're going to have to explicitly ignore these three warnings, unless there's anything we can do from our application to fix it? I don't think we could 'consider declaring it as static instead', correct?

The currently created BeanPostProcessor [loadBalancerWebClientBuilderBeanPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead.

@yazanT
Copy link

yazanT commented Apr 9, 2024

@stefan-g That issue has already been fixed in 4.1.1. These warnings are by design - we don't want the LB-postprocessing-related beans to be further post-processed; the issue was that some other beans were not being post-processed correctly; this should be fixed. Please get back to us if you observe an actual issue in functioning of the configuration and not the warning.

Hi,
I have a case where I configure a @LoadBalanced restTemplate in a configuration class @Configuration
In another class annotated with @EnableWebSecurity I define a jwtDecoder as follows:

    @Bean
    public JwtDecoder jwtDecoder() {
        DelegatingOAuth2TokenValidator<Jwt> delegate = new DelegatingOAuth2TokenValidator<>(
                JwtValidators.createDefault());

        NimbusJwtDecoder decoder = NimbusJwtDecoder.withJwkSetUri("lb://authServerid/.well-known/jwks.json")
                .restOperations(restTemplate)
                .build();

        decoder.setJwtValidator(delegate);
        return decoder;
    }

On startup I get the following error: "Invalid JWK Set URL "lb://authorization-server/.well-known/jwks.json" : unknown protocol: lb". And my service is down.
This code worked on Springboot 2.x
I am wondering if this is related to this change of design and if so, should we change how we initialize our decoder ?

@OlgaMaciaszek
Copy link
Collaborator

Hello @yazanT , the lb scheme is only ever used in Spring Cloud Gateway route definitions. Use correct corresponding scheme (for example, https).

@khundaqji
Copy link

khundaqji commented Apr 23, 2024

Updated the spring cloud version to 2023.0.1 released around 27th March, which is supposed to have the fix. Most of these WARN logs are gone. However two are still showing on startup, referring to the same lbRestClientPostProcessor.

The Service is a the discovery, that has only one dependency "org.springframework.cloud:spring-cloud-starter-netflix-eureka-server" and with nothing more than a main Application annotated with

@EnableEurekaServer @SpringBootApplication

The following is a custom-formatted log statement in our app

org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker�[0;39m|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.|

org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker�[0;39m|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
Copy link
Collaborator

The warning logs do not constitute an issue. Boot just warns that DeferringLoadBalancerInterceptor and DeferringLoadBalancerInterceptorConfig will not be eiligible for further post-processing. We do not want them to be. The bug was that some other beans were not being post-processed when they should have been, and that has been fixed.

@SELiOTe
Copy link

SELiOTe commented Jun 2, 2024

After I upgrade to spring-boot-starter-parent:3.3.0 and spring-cloud-dependencies:2023.0.2, this warning still exists

@OlgaMaciaszek
Copy link
Collaborator

Please see: #1315 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done