Skip to content

RestTemplateBuilder with readtimeout and httpclient5 fails with IllegalStateException #29404

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

Closed
soft4rchitecture opened this issue Oct 31, 2022 · 1 comment
Labels
for: external-project Needs a fix in external project status: duplicate A duplicate of another issue

Comments

@soft4rchitecture
Copy link

Affects: org.springframework.boot:spring-boot:3.0.0-RC1


What are we trying to do ?

instantiate a RestTemplateBuilder while having org.apache.httpcomponents.client5:httpclient5 on the runtime classpath.
(probable explanation in the end)

reproduce

https://gist.github.com/soft4rchitecture/729cf677a49d6d07a852aa22e1c9f830

expected result

the test succeeds

current result

the test fails with the following stack trace

preliminary explanations

org.springframework.boot.web.client.ClientHttpRequestFactorySupplier is called to supply a CLientHttpRequestFactory.
If org.apache.hc.client5.http.impl.classic.HttpClients is on the class path, then org.springframework.http.client.HttpComponentsClientHttpRequestFactory is provided.
HttpComponentsClientHttpRequestFactory actually has the setReadTimeout() method deprecated since 6.0.
When org.springframework.boot.web.client.RestTemplateBuilder.RequestFactoryCustomizer#setReadTimeout calls
org.springframework.http.client.HttpComponentsClientHttpRequestFactory#setReadTimeout then expection is thrown

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 31, 2022
@bclozel
Copy link
Member

bclozel commented Oct 31, 2022

Closing as a duplicate of spring-projects/spring-boot#32857
Thanks!

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2022
@bclozel bclozel added status: duplicate A duplicate of another issue for: external-project Needs a fix in external project and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project Needs a fix in external project status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants