No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalancer
由于SpringCloud Feign在Hoxton.M2 版本之后不再使用Ribbon而是使用spring-cloud-loadbalancer,所以不引入spring-cloud-loadbalancer会报错
此方案下的:
就算加入load balancer,但是依然会报同样的错。原因是:nacos中ribbon会造成loadbalanc包失效
所以要先exclude ribbon:
<!-- 服务注册与发现 --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <version>2.2.0.RELEASE</version> <exclusions> <exclusion> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-ribbon</artifactId> </exclusion> </exclusions> </dependency>
再引入load balancer:
<!--load balancer--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-loadbalancer</artifactId> <version>2.2.2.RELEASE</version> </dependency>
修改它的pom文件中spring cloud的版本
修改了下spring boot版本
参考:https://www.cnblogs.com/npeng/p/14272634.html