-
Notifications
You must be signed in to change notification settings - Fork 705
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
Comments
I faced the same problem while developing my application. Spring Boot 3.2.0. Spring Cloud 2023.0.0.
|
Same problem |
me too |
mee too |
There is an open PR that will hopefully fix this #1304 |
here is my logs:
|
- 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
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. |
I'll provide detailed example later, but my problem was the following
|
Ok, thanks for the information. Will wait for the sample. |
https://github.com/ZIRAKrezovic/spring-cloud-reproducer
Half of spring boot is broken when you define a @loadbalancer RestTemplate @bean inside @autoConfiguration class. |
Thanks for the sample @ZIRAKrezovic, will take a look. Also, could you please let us know why you're trying to instantiate the |
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 ... |
@LoadBalanced
bean instantiated in auto-configuration
Thanks, @ZIRAKrezovic, I was able to reproduce the issue. The problem is not the |
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 |
@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 thanks for the heads up and the effort to get this released! |
@OlgaMaciaszek do you plan also to bump version and release spring-cloud-dependencies? |
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. |
@OlgaMaciaszek we still have this error on one bean after bumping version of spring cloud commons:
Could it be related to the same issue? |
Hello @piotrszczepankowski this does not seem to be related. |
@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 |
@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 |
@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. should that be fixed in this version? |
@stefan-g That issue has already been fixed in |
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 <?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.
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);
}
}
server:
port: 8080
spring:
cloud:
gateway:
routes:
- id: TestRoute
uri: https://example.com
predicates:
- Path=/** If I then run the application via
|
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. |
Ok thanks @OlgaMaciaszek for confirming. We currently monitor for and raise production alerts for any 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?
|
Hi,
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. |
Hello @yazanT , the |
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 following is a custom-formatted log statement in our app
|
The warning logs do not constitute an issue. Boot just warns that |
After I upgrade to spring-boot-starter-parent:3.3.0 and spring-cloud-dependencies:2023.0.2, this warning still exists |
Please see: #1315 (comment) |
Describe the bug
Spring Cloud 2023.0.0, Spring Boot 3.2.0
On application startup, I see the messages such as:
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.
The text was updated successfully, but these errors were encountered: