refactor: 设置restTemplateWithTimeout 超时时间10s

This commit is contained in:
Captain.B 2020-07-20 14:13:59 +08:00
parent 2860b91508
commit 0edc40b09e
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ public class WebConfig implements WebMvcConfigurer {
HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(); HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory();
httpRequestFactory.setConnectionRequestTimeout(4000); httpRequestFactory.setConnectionRequestTimeout(4000);
httpRequestFactory.setConnectTimeout(4000); httpRequestFactory.setConnectTimeout(4000);
httpRequestFactory.setReadTimeout(5000); httpRequestFactory.setReadTimeout(10 * 1000);
restTemplate.setRequestFactory(httpRequestFactory); restTemplate.setRequestFactory(httpRequestFactory);
return restTemplate; return restTemplate;
} }