Last updated 1 year ago
与 Eureka 不同,当 Spring Cloud Gateway 使用 Nacos 作为服务发现时,无论是选择自动路由映射还是手动路由映射,都需要引入 spring-cloud-starter-loadbalancer 依赖,如下所示:
如果缺少上述依赖,当通过 gateway 访问服务时,会得到如下的异常信息:
与 OpenFeign 集成时,同样需要引入 spring-cloud-starter-loadbalancer 依赖,否则服务在启动时会报错。
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-loadbalancer</artifactId> </dependency>
There was an unexpected error (type=Service Unavailable, status=503).