添加负载均衡
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.gzzn.omms.adminapi.config;
|
package com.gzzn.omms.adminapi.config;
|
||||||
|
|
||||||
|
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||||
@@ -9,6 +10,7 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class RestTemplateConfig {
|
public class RestTemplateConfig {
|
||||||
@Bean
|
@Bean
|
||||||
|
@LoadBalanced
|
||||||
public RestTemplate restTemplate(ClientHttpRequestFactory factory){
|
public RestTemplate restTemplate(ClientHttpRequestFactory factory){
|
||||||
return new RestTemplate(factory);
|
return new RestTemplate(factory);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user