SpringCloud Gateway 访问 nacos 服务时404

gateway application.yml 配置

server:
  port: 8219

#使用服务发现路由
spring:
  cloud:
    gateway:
      httpclient:
        pool:
          max-idle-time: 5000
          max-connections: 30
      discovery:
        locator:
          enabled: false
      routes:
      #设置路由的id,一般和服务名相同
      - id: service-order-waybill
        #设置路由的地址,lb 是nacos服务注册中心的服务名
        uri: lb://service-order-waybill
        #设置路由断言,代理servicerId为 auth-service 的 /auth/路径
        predicates:
        - Path=/waybill/**

前端访问的地址:http://localhost:8219
访问后报404的响应信息:
`Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Jul 07 20:51:52 CST 2022
There was an unexpected error (type=Not Found, status=404).
No message available`

问题解决:
在pom.xml中引入自己需要访问的接口所在的模块信息:

        <!--引入需要调用的模块-->
        <dependency>
            <groupId>com.gxa</groupId>
            <artifactId>service_order_waybill</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>

版权声明:本文为m0_48311988原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。