diff --git a/udf-starter-core/src/main/java/org/itkk/udf/core/BaseApplication.java b/udf-starter-core/src/main/java/org/itkk/udf/core/BaseApplication.java index e4ceb23..0fb84bd 100644 --- a/udf-starter-core/src/main/java/org/itkk/udf/core/BaseApplication.java +++ b/udf-starter-core/src/main/java/org/itkk/udf/core/BaseApplication.java @@ -11,6 +11,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import org.itkk.udf.core.xss.XssStringJsonSerializer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -61,6 +62,18 @@ public class BaseApplication { return objectMapper; } + /** + * 描述 : restTemplate + * + * @param requestFactory requestFactory + * @return RestTemplate + */ + @Bean + @LoadBalanced + public RestTemplate restTemplate(ClientHttpRequestFactory requestFactory) { + return new RestTemplate(requestFactory); + } + /** * 描述 : externalRestTemplate *