Waseem Ishaq
Waseem Ishaq

Reputation: 1

SpringBoot 3 RestTemplate-HttpComponentsClientHttpRequestFactory incompatible with org.apache.http.client.HttpClient

HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient());

'HttpComponentsClientHttpRequestFactory(org.apache.hc.client5.http.classic.HttpClient)' in 'org.springframework.http.client.HttpComponentsClientHttpRequestFactory' cannot be applied to '(org.apache.http.client.HttpClient)'

Need solution to solve this in any other alternative way with this dependency specifically.

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.2</version>
</dependency>

Upvotes: 0

Views: 460

Answers (1)

authorizeduser
authorizeduser

Reputation: 177

As mentioned in the Migration Guide, support for Apache HttpClient has been removed in Spring Framework 6.0, immediately replaced by org.apache.httpcomponents.client5:httpclient5. It is not possible to use apache httpclient 4.x versions along with spring 6.x version.

Upvotes: 0

Related Questions