我在Spring Cloud Gateway中创建了一个自定义过滤器,方法是使用“ LoggingGlobalPreFilter”扩展该类。
我有以下路线。
return builder.routes().route(r -> r.path("/first/**").uri("http://localhost:8222"))
.route(r -> r.path("/seconf/**").uri("http://localhost:8333")).build();
不确定如何在此处添加自定义过滤器。互联网上的所有文章都在谈论在.yml文件中配置过滤器。
谢谢!
答案 0 :(得分:0)
@Component
public class CustomFilter implements GlobalFilter, Ordered {
}