Spring Cloud API GATEWAY 路由不起作用

问题描述 投票:0回答:1

我使用 Spring Cloud Gateway 和微服务开发新项目。当我使用微服务自己的端口运行该方法时,该方法有效。但是当我用网关的端口调用它时,路由操作不会发生。另外,User Service 和 Gateway 注册在 Eureka Server 上,并使用 DiscoveryClient 注解

(类型=未找到,状态=404)。

网关 YAML 文件

 server: port: 9191 spring: application: name: API-GATEWAYcloud: gateway:  routes:  -id: USER-SERVICE uri: lb://USER-SERVICE/ predicates:-Path=/user/**

eureka: client: service-url: defaultZone: http://localhost:8761/eureka/ register-with-eureka: true fetch-registry: true instance: hostname: localhost 

java spring microservices spring-cloud api-gateway
1个回答
0
投票

我使用 yml 文件进行配置。我将 yml 文件转换为属性文件,问题解决了

© www.soinside.com 2019 - 2024. All rights reserved.