You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
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.
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?
Activity
bclozel commentedon Aug 4, 2022
httpclient5 support was introduced in #24700 for
WebClient. WhileRestTemplateis 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 commentedon Aug 9, 2022
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
HttpComponentsClientHttpRequestFactoryclass that uses httpclient5. We can probably name that class asHttpComponentsClient5HttpRequestFactory. If it's okay with the team then I can raise a PR as well.bclozel commentedon Sep 13, 2022
We've discussed this as a team and we decided to migrate the existing
ClientHttpRequestFactoryto 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.[-]RequestFactory Support for httpclient5 in spring-web[/-][+]Upgrade RestTemplate to HttpClient 5[/+]OndraZizka commentedon Nov 2, 2022
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 commentedon Dec 20, 2022
@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 commentedon Sep 9, 2024
I dont know how to update httpclient from 4 to 5, HttpComponentsClientHttpRequestFactory
bclozel commentedon Sep 9, 2024
@makewheels please ask a question on StackOverflow.
glorinli commentedon Nov 22, 2024
https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java
HttpComponentsClientHttpRequestFactory receives classic.HttpClient but I can only create org.apache.http.impl.client.CloseableHttpClient
So I am also unable to create RestTemplate based on httpclient5.
bclozel commentedon Nov 22, 2024
You will need to upgrade your library to version 5. See https://hc.apache.org/httpcomponents-client-5.4.x/current/httpclient5/apidocs/org/apache/hc/client5/http/impl/classic/CloseableHttpClient.html
Upgrade RestTemplate to HttpClient 5