title: Spring Security filter not invoked
body: <p>I have below code for filters configured in a spring boot application. My second filter which is B, is not invoke when i make a request.</p>
  
  <pre><code>import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.builders.WebSecurity;
  import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;
  
  @Configuration
  @EnableWebMvcSecurity
  public class SecurityConfig extends WebSecurityConfigurerAdapter  {
      @Override
      public void configure(WebSecurity webSecurity) throws Exception {
          webSecurity.ignoring().antMatchers(HttpMethod.GET, "/health");
      }
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
          http.addFilterBefore(new A(), BasicAuthenticationFilter.class);
          http.addFilterAfter(new B(), new A().getClass());
      }
  }
  
  import org.springframework.web.filter.GenericFilterBean;
  public class A extends GenericFilterBean {
  
      @Override
      public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
              throws IOException, ServletException {
          System.out.println("filter A");
      }
  }
  
  import org.springframework.web.filter.GenericFilterBean;
  public class B extends GenericFilterBean {
  
      @Override
      public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
              throws IOException, ServletException {
          System.out.println("filter B");         
      }
  }
  </code></pre>
  
  <p>Edit:</p>
  
  <pre><code> public class A extends GenericFilterBean {
  
          @Override
          public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException {
               System.out.println("filter A Before");
               arg2.doFilter(arg0,arg1);
               System.out.println("filter A After");
          }
  }
  </code></pre>