【JAVA】RestTemplate配置超时时间
作者:互联网
配置类:
@Bean public RestTemplate restTemplate() { SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setConnectTimeout(5000); requestFactory.setReadTimeout(3500); RestTemplate restTemplate = new RestTemplate(requestFactory); return restTemplate; }
调用:SpringBoot使用Bean,调用RestTemplate
private RestTemplate restTemplate;
标签:JAVA,restTemplate,RestTemplate,Bean,new,超时,requestFactory,SimpleClientHttpReques 来源: https://www.cnblogs.com/z-Z-/p/16613416.html