spring boot 整合gateway 过滤器不生效

img


有没有牛人给看看 访问的是本地的controller
127.0.0.1:9022/product/1
localhost:9002/product/1 都不生效 进过滤器

试试加个网页过滤?@WebFilter(),或者在启动类里面加
@Bean
public FilterRegistrationBean registrationBean() {
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.addUrlPatterns("/*");
return bean;
}方法
具体代码需要你自己查一下

gateway需要你走网关才能拦截,默认配置下你注入到容器就会走你的拦截器了