-
Notifications
You must be signed in to change notification settings - Fork 41.7k
Description
Environment
- Spring Boot 4.0.0 (main branch)
- JDK 24 (also reproduces on JDK 21)
Summary
In a WebFlux application, REST_CLIENT-based HTTP Service clients are filtered out even when virtual threads are enabled (no bean, no spring.http.serviceclient.* properties applied) because HttpServiceClientAutoConfiguration is guarded only by NotReactiveWebApplicationCondition. The condition skips all reactive apps, so the virtual-threads path never runs (it would also skip when virtual threads are disabled).
Steps to reproduce
- Set
spring.http.serviceclient.echo.base-url=https://example.com. - Use WebFlux, add
@ImportHttpServices(clientType = ClientType.REST_CLIENT, group = "echo"). - Set
spring.threads.virtual.enabled=trueand ensure the defaultapplicationTaskExecutorexists. - Observe the REST_CLIENT HTTP Service is not auto-configured (base URL not applied; bean missing or defaults).
Expected behavior
spring.http.serviceclient.* properties (base URL, headers, etc.) should apply in reactive apps when virtual threads are enabled.
Actual behavior
The auto-configuration is filtered out by the reactive condition, so properties are not applied in reactive + VT.
Suspected cause
HttpServiceClientAutoConfiguration depends solely on NotReactiveWebApplicationCondition, which excludes reactive apps. The RestClient side already has NotReactiveWebApplicationOrVirtualThreadsExecutorEnabledCondition, but it is package-private and not reused here, so the virtual-threads path is missed.
Notes
- Added regression test: WebFlux +
spring.threads.virtual.enabled=true+@ImportHttpServicescurrently fails on the main branch. - Verification:
:module:spring-boot-restclient:checkandcheckFormatMainpassed on JDK 24.