mirror of
https://gitee.com/wangkang/udf.git
synced 2026-10-28 10:13:42 +00:00
添加负载均衡的RestTemplate
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user