title: Prevent Spring Boot from registering a servlet filter
body: <p>I have a Spring Boot WebMVC application, and a bean that inherits from AbstractPreAuthenticatedProcessingFilter which I am explicitly adding to a specific spot in the Spring Security filter chain. My Spring Security configuration looks like this:</p>
  
  <pre><code>&lt;http pattern="/rest/**"&gt;
    &lt;intercept-url pattern="/**" access="ROLE_USER"/&gt;
    &lt;http-basic/&gt;
    &lt;custom-filter after="BASIC_AUTH_FILTER" ref="preAuthenticationFilter"/&gt;
  &lt;/http&gt;
  
  &lt;beans:bean id="preAuthenticationFilter" class="a.b.PreAuthenticationFilter"&gt;
    &lt;beans:property name="authenticationManager" ref="customAuthenticationManager"/&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>The security configuration works. The problem is, because the PreAuthenticationFilter class inherits from AbstractPreAuthenticatedProcessingFilter, Spring Boot treats it as a general purpose servlet filter and is adding it to the servlet filter chain for all requests. I don't want this filter to be part of the filter chain for all requests. I only want it to be part of the specific Spring Security filter chain that I've configured. Is there a way to prevent Spring Boot from automatically adding the preAuthenticationFilter bean to the filter chain?</p>