谓词 Method · SpringCloud微服务实战 · 看云
7.谓词 Method
导航
Method方法路由谓词工厂采用一个或多个参数:要匹配的HTTP方法。
本节代码地址
7.1 应用配置
我们在配置中设置方法的请求方式为Get、Post ,当请求方式为其它方式就会返回404
server:
port: 8699
spring:
application:
name: fw-gateways-gateway
profiles:
active: host_route
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka/
---
spring:
cloud:
gateway:
routes:
- id: method_route
uri: lb://fw-cloud-ribbon-server
predicates:
- Method=GET,POST
profiles: method_route
7.2 应用启动
Get 请求
将GET去掉测试
- Method=POST

