package com.webmanage.config;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
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配置类
|
*/
|
@Configuration
|
public class RestTemplateConfig {
|
|
@Autowired
|
private WorkflowProperties workflowProperties;
|
|
@Bean
|
public RestTemplate restTemplate() {
|
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
|
// 设置连接超时时间
|
factory.setConnectTimeout(workflowProperties.getRestTemplate().getConnectTimeout());
|
|
// 设置读取超时时间
|
factory.setReadTimeout(workflowProperties.getRestTemplate().getReadTimeout());
|
|
return new RestTemplate(factory);
|
}
|
}
|