Skip to content

Spring boot filter is ignored

I m trying to create a filter, but it is ignored

public class CarsFilter extends OncePerRequestFilter {
    protected void doFilterInternal(HttpServletRequest httpServletRequest,
                                    HttpServletResponse httpServletResponse,
                                    FilterChain filterChain) throws ServletException, IOException {

        httpServletResponse.addHeader("X", "XX");
        filterChain.doFilter(httpServletRequest, httpServletResponse);

Did I forget to do smth?



The problem was in the absent of pom dependency


Instead the Filter was loaded from some java library and therefor compilation was successful (can be removed in module settings)

User contributions licensed under: CC BY-SA
1 People found this is helpful