当前位置:   article > 正文

No Feign Client for loadBalancing defined. Didyou forget to include spring-cloud-starter-loadbalance_no feign client for loadbalancing defined. did you

no feign client for loadbalancing defined. did you forget to include spring-

Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalancer?

OpenFeign报错

No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalancer?
  • 1

Spring Cloud版本 2020.0.3
Spring Boot版本 2.4.6

原因是因为SpringCloud Feign在Hoxton.M2 RELEASED版本之后抛弃了Ribbon,使用了spring-cloud-loadbalancer,所以我们这里还需要引入spring-cloud-loadbalancer的依赖,否则就会报错

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-loadbalancer</artifactId>
        </dependency>
  • 1
  • 2
  • 3
  • 4

同时nacos也要排除掉ribbo

 <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-netflix-ribbon</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

到这里问题解决

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/293115
推荐阅读
相关标签
  

闽ICP备14008679号