You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Spring Cloud Gateway无法将请求路由至微服务的问题求助

Spring Cloud Gateway无法将请求路由至微服务的问题求助

大家好,我最近在配置Spring Cloud Gateway的时候卡壳了,想请各位大佬帮忙排查下问题。

我跟着教程写了application.properties的网关配置,内容如下:

server.port=9000
spring.application.name=UserMS
spring.cloud.gateway.routes[0].id=UserMS
spring.cloud.gateway.routes[0].uri=http://localhost:8080
spring.cloud.gateway.routes[0].predicates[0]=Path=/user/**

但是当我用Postman请求http://localhost:9000/user/register的时候,却收到了错误提示:

"message": "No static resource user/register for request `'http://localhost:9000/user/register'."

看这个报错感觉像是网关压根没找到对应的路由规则,直接去查找静态资源了…

目前我用的依赖是这些:

<dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-gateway-server-webflux</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.projectreactor</groupId>
        <artifactId>reactor-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

有没有朋友遇到过类似的情况?麻烦帮我看看哪里配置错了,或者有没有什么我漏掉的细节?先谢谢大家了!

火山引擎 最新活动