Using Proxy with HttpComponentsClientHttpRequestFactory and RestTemplate
Can some one guide me how can I configure HttpComponentsClientHttpRequestFactory to use proxy server. All examples I have seen are using SimpleClientHttpRequestFactory . If you do not mind using Apache Http Client it is not very complicated and there are 2 possibilities: If single proxy for all targets is enough for you: HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory( HttpClientBuilder.create() .setProxy(new HttpHost("myproxy.com", 80, "http")) .build()); restTemplate = new RestTemplate(clientHttpRequestFactory); Or if you want to