nacos用于负载均衡使用了ribbon组件,现如今ribbon已经不维护了,Spring Cloud LoadBalancer是Spring Cloud官方自己提供的客户端负载均衡器,抽象和实现,用来替代Ribbon(已经停更)
1.去除ribbon的依赖
<!--nacos-服务注册发现-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<!--将ribbon排除-->
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</exclusion>
</exclusions>
</dependency>
2.添加依赖
<!--添加loadbalanncer依赖, 添加spring-cloud的依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
3.添加注解
标签:负载,loadbance,spring,nacos,starter,ribbon,cloud From: https://www.cnblogs.com/guolm1/p/17761602.html