我正在从Netflix Zuul迁移到Spring Cloud Gateway,找不到与Netflix Zuuls should Filter方法等效的方法。没有对等的吗?
Netflix Zuul代码我想取代:
@Override
public boolean shouldFilter() {
return true; // Yes run this filter!
}
一个选项是在Spring Cloud Gateway筛选器方法中执行if子句。
示例:
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
if(someCondition == false) {
return chain.filter(exchange); // Skip this filter and continue to the next filter
}
// More filter code
}