Skip to content

Exclude @LoadBalanced RestClient/WebClient builders from Eureka transport - #4602

Open
arimu1 wants to merge 1 commit into
spring-cloud:mainfrom
arimu1:fix/4591-eureka-skip-loadbalanced-restclient
Open

Exclude @LoadBalanced RestClient/WebClient builders from Eureka transport#4602
arimu1 wants to merge 1 commit into
spring-cloud:mainfrom
arimu1:fix/4591-eureka-skip-loadbalanced-restclient

Conversation

@arimu1

@arimu1 arimu1 commented Sep 13, 2026

Copy link
Copy Markdown

Summary

  • Resolve Eureka registry RestClient.Builder / WebClient.Builder candidates by excluding beans annotated with @LoadBalanced, so calls to the Eureka server URL are not routed through the load balancer (fixes No instances available for localhost when only a load-balanced builder is registered).
  • Fall back to RestClient.builder() / WebClient.builder() when every registered builder is load-balanced.
  • Add context tests covering RestClient-only, plain+load-balanced, and WebClient-only setups.

Fixes gh-4591 (same root cause as gh-4524).

Test plan

  • ./mvnw -pl spring-cloud-netflix-eureka-client -Dtest=LoadBalancedEurekaHttpClientBuilderConfigurationTests test (JDK 21)
  • ./mvnw -pl spring-cloud-netflix-eureka-client -am test — module suite passes except pre-existing EurekaConfigServerBootstrapperIntegrationTests (Docker not available locally)

Eureka registry calls must not use load-balanced RestClient or WebClient
builders. Filter @LoadBalanced beans when resolving builders and fall back
to plain factory methods when needed.

Fixes spring-cloudgh-4591

Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@LoadBalanced with RestClient` — the problem and the fix

2 participants