用Apache HttpClient替换默认的requestFactory:
HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory( HttpClientBuilder.create().build()); RestTemplate restTemplate = new RestTemplate(clientHttpRequestFactory);
将Apache Http Client添加到pom.xml中
org.apache.httpcomponents httpclient 4.5.1