加了个网关gateway,访问网关端口,却访问不到内容
第一部分:
这是我的gateway网关yaml配置:
server:
port: 9727
spring:
application:
name: cloud-gateway
cloud:
geteway:
routes:
- id: payment_routh
uri: http://localhost:8001
predicates:
- Path=/payment/get/**
- id: payment_routh2
uri: http://localhost:8001
predicates:
- Path=/payment/lb/**
eureka:
instance:
hostname: cloud-gateway-service
client:
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: http://eureka7001.com:7001/eureka/
第二部分:
这是我的另一个服务提供者的内容:(Controller)
@GetMapping("/payment/get/{id}")
public CommonResult getPaymentById(@PathVariable("id") int id) {
Payment payment = paymentService.getPaymentById(id);
log.info("查询结果:" + payment);
if (payment != null) {
return new CommonResult(200, "查询成功,port:"+port, payment);
} else {
return new CommonResult(444, "查询失败,port"+port, null);
}
}
第三部分:
开始访问:(不经过网关访问可以得到数据:地址是:http://http://localhost:8001/payment/get/3,可以得到数据)
但是经过网关访问(地址是:http://http://localhost:9727/payment/get/3),却返回错误:
Whitelabel Error Page
This application has no configured error view, so you are seeing this as a fallback.
Wed Jun 23 16:55:58 CST 2021
[7beaa06d-1] There was an unexpected error (type=Not Found, status=404).
不知道为啥会出现这样的问题??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题解决了,把gateway写成了geteway了