spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

RequestFactory Support for httpclient5 in spring-web

Open pwhittlesea opened this issue 3 years ago • 2 comments

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.

pwhittlesea avatar Aug 04 '22 14:08 pwhittlesea

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.

bclozel avatar Aug 04 '22 14:08 bclozel

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.

rasikaAjoshi23 avatar Aug 09 '22 18:08 rasikaAjoshi23

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.

bclozel avatar Sep 13 '22 08:09 bclozel

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?

OndraZizka avatar Nov 02 '22 15:11 OndraZizka

@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?)?

billNaylor avatar Dec 20 '22 18:12 billNaylor