SpringCloud - gateway 报错: type=Service Unavailable, status=503
后端没有报错,前端返回503,如果配置文件确定没有问题的话,应该是缺依赖的问题:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
附录
配置文件:
server:
port: 8888
spring:
application:
name: cloud‐gateway
cloud:
nacos:
discovery:
server‐addr: localhost:8848
namespace: 54fdd84f-44bb-45c1-b9c7-2b13bb4dca57
gateway:
discovery:
locator:
enabled: true
lower-case-service-id: true
routes:
- id: cloud-order
uri: lb://cloud-order
predicates:
- Path=/order/**
依赖:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
<version>3.0.3</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>${spring-cloud-alibaba.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>${spring-cloud-alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>3.0.6</version>
</dependency>