spring cloud之ribbon

spring cloud之ribbon

 

 

 

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
eureka该jar中已集成ribbon,无需在引用,若非引用也无碍
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>

spring cloud之ribbon

 

 

代码如下
@Configuration
public class ApplicationContextConfig {

@Bean
@LoadBalanced
public RestTemplate getRestTemplate(){
return new RestTemplate();
}
}







上一篇:Spring Cloud学习(四)Ribbon负载均衡服务调用


下一篇:feign和ribbon的重试及异常捕捉