me.youm.frame.webmvc.config.RestTemplateConfiguration Maven / Gradle / Ivy
package me.youm.frame.webmvc.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
/**
* RestTemplate
* @author youta
*/
@Configuration
public class RestTemplateConfiguration {
@Bean
public RestTemplate restTemplate() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(5000);
requestFactory.setReadTimeout(3000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
return restTemplate;
}
}