Skip to content

Ensure RestClient uses Virtual Thread Executor when spring.threads.virtual.enabled=true and JdkClientHttpRequestFactoryBuilder #46404

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

smartandhandsome
Copy link

Previously, even when setting spring.threads.virtual.enabled=true, HttpClient in RestClient continued to create platform threads. This meant that enabling virtual threads via configuration did not actually switch the executor as users would expect.

What has changed

  • The configuration for the ClientHttpRequestFactoryBuilder bean has been split based on the threading mode.
  • When Threading.VIRTUAL is active and the builder is a JdkClientHttpRequestFactoryBuilder, the builder is explicitly configured to use a virtual thread executor.
  • For platform threads, the previous behavior is preserved.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants