Skip to content
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

Upgrade RestTemplate to HttpClient 5 #28925

Closed
pwhittlesea opened this issue Aug 4, 2022 · 7 comments
Closed

Upgrade RestTemplate to HttpClient 5 #28925

pwhittlesea opened this issue Aug 4, 2022 · 7 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@pwhittlesea
Copy link

Affects: 5.3.20


httpclient was last updated on Oct 06 2020 and was superseded by httpclient5 which is being actively maintained.

See the upgrade guide here.

The HttpComponentsClientHttpRequestFactory class relies on httpclient and is not compatible with httpclient5.
As httpclient version 4 is no longer supported it would be good to have RequestFactory support for version 5.

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

bclozel commented Aug 4, 2022

httpclient5 support was introduced in #24700 for WebClient. While RestTemplate is in maintenance mode as of #24503, shipping a outdated integration with httpclient might be problematic in the 6.0 line. Something we should consider for 6.0 maybe. I'll mark this for team discussion.

@rasikaAjoshi23
Copy link

Hi @bclozel,

I was investigating this issue, and I have an idea through which we can support both httpclient4 and httpclient5. We can create a counterpart of the HttpComponentsClientHttpRequestFactory class that uses httpclient5. We can probably name that class as HttpComponentsClient5HttpRequestFactory. If it's okay with the team then I can raise a PR as well.

@bclozel bclozel added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed for: team-attention status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 13, 2022
@rstoyanchev rstoyanchev added this to the 6.0.0-RC1 milestone Sep 13, 2022
@bclozel
Copy link
Member

bclozel commented Sep 13, 2022

We've discussed this as a team and we decided to migrate the existing ClientHttpRequestFactory to using the new httpclient5 artifact in Spring Framework 6.0.0. We'll leave the existing arrangement in place in the 5.3.x line. We'll need to make it a noteworthy comment in our release notes, as this will be a new baseline requirement for Spring Framework 6.0.

@OndraZizka
Copy link

Not directly related, but: I can't persuade httpclient 4.x not to spam the log with DEBUG messages, and no logging configuration seems to help. I could configure httpclient 5 to stop spamming, as it uses SLF4J. Any hints?

@billNaylor
Copy link

@pwhittlesea It seems the link you give under 'here' has gone away, can it now be replaced with:
https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/preparation.html
(if this is what you mean?)?

@makewheels
Copy link

I dont know how to update httpclient from 4 to 5, HttpComponentsClientHttpRequestFactory

@bclozel
Copy link
Member

bclozel commented Sep 9, 2024

@makewheels please ask a question on StackOverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

9 participants