【问题标题】:Is it possible to add another filter in addition to Katharsis filter除了 Katharsis 过滤器之外,是否可以添加另一个过滤器
【发布时间】:2021-04-18 17:50:21
【问题描述】:

我在我的 Spring Boot 应用程序中使用 Katharsis 以支持 json-api。

我使用资源设置 Katharsis,如下所述:https://www.baeldung.com/json-api-java-spring-web-app

现在,我想在我的 Spring Boot 应用程序中添加另一个自定义过滤器。我尝试添加此过滤器:

@Component
public class SchemaFilter implements Filter {

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        String application = request.getHeader("application");
        System.out.println(application);
    }

}

但它不起作用。

有什么想法吗?

【问题讨论】:

    标签: java spring-boot katharsis


    【解决方案1】:

    我忘记在我的过滤器中添加@Order 注释:

    @Order(Ordered.HIGHEST_PRECEDENCE)
    

    【讨论】:

      猜你喜欢
      • 2014-11-21
      • 2017-11-22
      • 2022-01-14
      • 2021-03-07
      • 1970-01-01
      • 1970-01-01
      • 2020-06-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多