Skip to content

Conversation

@Nhahan
Copy link

@Nhahan Nhahan commented Nov 24, 2025

Fixes gh-48273

Summary

REST_CLIENT-based HTTP Service clients do not apply spring.http.serviceclient.* properties in WebFlux applications, even when spring.threads.virtual.enabled=true, because the current condition strictly excludes all reactive applications.

Changes

  • Update HttpServiceClientAutoConfiguration to use a condition that permits reactive applications when virtual threads and applicationTaskExecutor are enabled.
  • Add matching package-private condition NotReactiveWebApplicationOrVirtualThreadsExecutorEnabledCondition in the service package (kept in sync with the existing one in autoconfigure package).
  • Add regression test: restClientServiceClientsApplyPropertiesWhenReactiveWithVirtualThreads().

Testing

  • Verified with ./gradlew :module:spring-boot-restclient:check
  • Verified with ./gradlew :module:spring-boot-restclient:checkFormatMain
  • New test confirms that auto-configuration activates and applies properties (e.g., base URL) when virtual threads are enabled in a reactive environment.

Previously, HttpServiceClientAutoConfiguration used
NotReactiveWebApplicationCondition, which prevented
activation in reactive apps even when virtual threads
were enabled.

This commit updates the condition to
NotReactiveWebApplicationOrVirtualThreadsExecutorEnabledCondition,
allowing HTTP Service Clients to work in reactive apps
when virtual threads are enabled, matching the behavior
of RestClientAutoConfiguration.

Closes spring-projectsgh-48273

Signed-off-by: Nhahan <kisy324@naver.com>
@wilkinsona wilkinsona changed the title Allow RestClient HTTP service auto-config in reactive apps when virtual threads are enabled Enabling virtual threads in a reactive web application does not enable auto-configuration of RestClient-based HTTP service clients Nov 25, 2025
@wilkinsona
Copy link
Member

See #44952 where we relaxed things in 3.5 for RestClient. It would seem reasonable for things to work similarly for HTTP service clients that are built on top of RestClient.

@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 25, 2025
@wilkinsona wilkinsona added this to the 4.0.x milestone Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RestClient HTTP service clients ignore properties in reactive + virtual threads

3 participants