欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Spring cloud 2020 gateway nacos 出现503的情况

程序员文章站 2024-03-20 22:36:52
...

在搭建spring cloud gateway 服务的时候,出现了503(sercice Unavailable),使用的是spring cloud 2020版本,注册中心选用的是nacos。
主要是因为 nacos兼容feign,feign集成ribbon,默认实现负载均衡;nacos不兼容spring cloud gateway自带的ribbon,所以我们只需要重新在gateway中引入feign依赖。

    <!--fegin组件 fhadmin.org-->
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>
    <!-- Feign Client for loadBalancing -->
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-loadbalancer</artifactId>
    </dependency>