Spring-Cloud对于gateway路由转发出现503 service Unavailable错误解决方案
Spring-Cloud对于gateway路由转发出现503 service Unavailable错误解决方案
·
在spring-cloud微服务项目中,我们都是通过gateway网关进行路由转发,但是在转发过程中出现了503 Service Unavailable错误,出现这个错误的原因是SpringCloud Feign在Hoxton.M2 RELEASED版本之后就不再使用Ribbon,而是使用spring-cloud-loadbalancer。具体情况如下:
首先,我们看一下前端的请求配置:
后端gateway网关配置:
解决方案:
出现这个问题的也是非常容易解决的,我们只需要在 gateway网关模块的pom文件中添加以下依赖便可解决:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
依赖添加好之后,重启gateway服务:
更多推荐
所有评论(0)