I am using Maven. when I include

<dependency> 
<groupId>org.apache.httpcomponents.client5</groupId> <artifactId>httpclient5</artifactId> 
<version>5.2.1</version>
</dependency>

in pom.xml i got httpclient5-5.2.1.jar, httpcore5-5.2.jar, and httpcore5-h2-5.2.jar in library folder of project.

I am noticing issues with HTTP client behavior since I have been upgrading the httpclient from 4 to 5 and it could be that RestTemplate is falling back to the JDK client.

org.apache.hc.client5.http.classic.HttpClient client = org.apache.hc.client5.http.impl.classic.HttpClients.custom()
                    .setConnectionManager(connectionManager)
                    .build(); 
final org.springframework.http.client.HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
requestFactory.setHttpClient(client);

the above setter method is causing the below compile time issue

The type org.apache.http.client.HttpClient cannot be resolved. It is indirectly referenced from required .class files

0

There are 0 best solutions below