在gateway路由微服务,请求微服务接口时,出现如下错误:
Whitelabel Error Page
This application has no configured error view, so you are seeing this as a fallback.
Wed Aug 28 11:58:27 CST 2024
[efe66cff-2] There was an unexpected error (type=Service Unavailable, status=503).
出现问题的原因是springcloud2021弃用了Ribbon,在2021版本nacos删除了Ribbon,所以无法通过lb路由到指定为服务,需要我们自己引入loadbalancer包
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-loadbalancer</artifactId> </dependency>
引入后问题得到解决!!!