时间"/>
Springboot2 RestTemplate设置超时时间
Spring boot 版本>=2.0
@Configuration
public class BeanConfig {@Beanpublic RestTemplate restTemplate() {SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();requestFactory.setConnectTimeout(5000);requestFactory.setReadTimeout(3000);RestTemplate restTemplate = new RestTemplate(requestFactory);return restTemplate;}
}
更多推荐
Springboot2 RestTemplate设置超时时间
发布评论