From 2c1ed50008389a01747272d52da68e89ac2f68c7 Mon Sep 17 00:00:00 2001 From: wangkang Date: Thu, 3 Aug 2017 15:18:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B4=9F=E8=BD=BD=E5=9D=87?= =?UTF-8?q?=E8=A1=A1=E7=9A=84RestTemplate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/itkk/udf/core/BaseApplication.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 *