title: How to add Conditional filters in springboot
body: <p>I have different filters in spring boot app that runs. I want to skip one filter from runing for few of the apis based on condition. I was able to do it by adding a condition in doFilterInternal. here the code for filter:</p>
  <pre><code>
  class ConditionalFilter extends OncePerRequestFilter {
    @Override
    protected void doFilterInternal(HttpServletRequest servletRequest, HttpServletResponse servletResponse, FilterChain filterChain) throws ServletException, IOException {
      HttpServletRequest httpRequest = (HttpServletRequest)servletRequest;
      HttpServletResponse httpResponse = (HttpServletResponse)servletResponse;
      if (!condition) {
          filterChain.doFilter(request, httpResponse);
      } else {
          someFilterLogic();
      }
    }
  }
  
  </code></pre>
  <p>Is there any better way of doing it?</p>