yml配置如下:
server:
port: 8080
spring:
application:
name: api-gateway-server
cloud:
gateway:
routes:
- id: product-service
uri: http://127.0.0.1:9001
predicates:
- Path=/product/**
直接訪問:
http://localhost:9001/product/1 沒有問題
通過gateway 訪問:
http://localhost:8080/product/1 報錯404
求大哥們幫忙看看呢?
uj5u.com熱心網友回復:
解決了:可能空格沒有對齊spring:
application:
name: api-gateway-server #服務名稱
cloud: #配置SpringCloudGateway的路由
gateway:
routes:
- id: product-service
uri: lb://service-product
predicates:
- Path=/product/**
discovery:
locator:
enabled: true
lower-case-service-id: true
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/61812.html
標籤:Web 開發
上一篇:最后10天沖刺金九銀十,看完這份檔案,offer多拿90%
下一篇:求教高手...幫幫忙,撰寫程式
