diff --git a/pom.xml b/pom.xml index ac48dae..f1303d3 100644 --- a/pom.xml +++ b/pom.xml @@ -156,6 +156,11 @@ spring-boot-configuration-processor true + + cn.hutool + hutool-all + 5.8.22 + diff --git a/src/main/java/com/hxjt/dataupload/template/RestTemplateConfig.java b/src/main/java/com/hxjt/dataupload/template/RestTemplateConfig.java new file mode 100644 index 0000000..68f7ea6 --- /dev/null +++ b/src/main/java/com/hxjt/dataupload/template/RestTemplateConfig.java @@ -0,0 +1,22 @@ +package com.hxjt.dataupload.template; + +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 RestTemplateConfig { + @Bean + public RestTemplate restTemplate(ClientHttpRequestFactory factory) { + return new RestTemplate(factory); + } + @Bean + public ClientHttpRequestFactory simpleClientHttpRequestFactory() { + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setReadTimeout(1500000); + factory.setConnectTimeout(50000); + return factory; + } +} \ No newline at end of file