用户模块

This commit is contained in:
2025-05-07 18:31:15 +08:00
parent a7d6d981a1
commit 13b800073e
3 changed files with 49 additions and 5 deletions

View File

@ -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;
}
}