title: Spring Boot 2.1 - @WebMvcTest without Spring Security Auto-Configuration
body: <p>Before migrating to Spring Boot 2.1, we had a couple of controller tests in our services utilizing <code>@WebMvcTest</code> in combination with <code>@AutoConfigureMockMvc</code>:</p>
  
  <pre><code>@WebMvcTest(SomeController.class)
  @AutoConfigureMockMvc(secure = false)
  public class SomeControllerTests { ... }
  </code></pre>
  
  <p>This had the effect that the Spring Security configuration was disabled and you could run MVC tests without mocking OAuth/JWT.</p>
  
  <p>In Spring Boot 2.1, the <code>secured</code> attribute is deprecated and the release notes mention that </p>
  
  <blockquote>
    <p>[...] @WebMvcTest looks for a WebSecurityConfigurer bean [...].</p>
  </blockquote>
  
  <p>In order to avoid the deprecated <code>secured</code> attribute and loading of our <code>WebSecurityConfigurer</code> we rewrote our tests to:</p>
  
  <pre><code>@WebMvcTest(
      value = SomeController.class,
      excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = WebSecurityConfigurer.class),
      excludeAutoConfiguration = MockMvcSecurityAutoConfiguration.class)
  public class SomeControllerTests { ... }
  </code></pre>
  
  <p>The question is: is there a more compact way in Spring Boot 2.1 to define such tests? </p>