RestTemplate 404 error upon adding HttpComponentsClientHttpRequestFactory

327 Views Asked by At

I am using RestTemplate exchange method to call a Microservice. Its working fine with the below code.

RestTemplate rs = new RestTemplate();
rs.exchange(........);

But if I add HttpComponentsClientHttpRequestFactory to the resttemplate, its giving 404 Not found exception with the below code

RestTemplate restTemplate = new RestTemplate();
HttpClient httpClient = HttpClientBuilder.create().setMaxConnTotal(200).setMaxConnPerRoute(100).build();
restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient));

restTemplate.exchange(......);
0

There are 0 best solutions below