用户模块
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
package com.greenorange.promotion.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Configuration
|
||||
public class HttpClientConfig {
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate(clientHttpRequestFactory());
|
||||
}
|
||||
|
||||
private ClientHttpRequestFactory clientHttpRequestFactory() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setConnectTimeout(500); // 设置连接超时为5秒
|
||||
factory.setReadTimeout(50); // 设置读取超时为5秒
|
||||
return factory;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user