title: Testing WebSecurityConfigurerAdapter
body: <p>This is my test, I'm adding additional header tests <a href="https://stackoverflow.com/q/30408391/206466">after testing my filter</a></p>
  
  <pre><code>@RunWith( SpringJUnit4ClassRunner.class )
  @WebAppConfiguration
  @EnableWebMvcSecurity
  @SpringApplicationConfiguration( classes = {
          MockServletContext.class,
          HttpSessionConfig.class,
          WebSecurityConfig.class
  } )
  @SuppressWarnings( "PMD.TooManyStaticImports" )
  public class HeadersTest {
  
      private MockMvc mockMvc = null;
  
      @Autowired
      private WebApplicationContext context;
  
      @Before
      public void setup() {
          mockMvc = MockMvcBuilders.webAppContextSetup( context )
                  .addFilter( new CORSFilter(), "/*" )
                  .build();
      }
  
      @Test
      public void testOptions() throws Exception {
          mockMvc.perform( options( "/" ) )
                  .andExpect( status().is2xxSuccessful() )
                  .andExpect( header().string( "Access-Control-Allow-Origin", notNullValue() ) )
                  .andExpect( header().string( "Access-Control-Allow-",
                          equalToIgnoringCase( "POST, GET, PUT, OPTIONS, DELETE" ) ) )
                  .andExpect( header().string( "Access-Control-Allow-Headers",
                          equalToIgnoringCase( "content-type, x-auth-token, x-requested-with" ) ) )
                  .andExpect( header().string( "Access-Control-Expose-Headers", equalToIgnoringCase( "Location" ) ) )
                  .andExpect( header().string( "Access-Control-Max-Age", notNullValue() ) )
          ;
      }    
  }
  </code></pre>
  
  <p>the test works if I remove <code>WebSecurityConfig.class</code> from the configuration, but when I add it I get this exception</p>
  
  <pre><code> Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.security.config.annotation.ObjectPostProcessor]
  </code></pre>
  
  <p>this is <code>WebSecurityConfig</code></p>
  
  <pre><code>@Configuration
  @Order( SecurityProperties.BASIC_AUTH_ORDER - 1 )
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Override
      protected void configure( final HttpSecurity http ) throws Exception {
          http.httpBasic().and()
                  .authorizeRequests()
                  .antMatchers( "/" ).permitAll()
                  .anyRequest().authenticated();
      }
  }
  </code></pre>
  
  <p>How can I change my test so that the <code>WebSecurityConfig</code> properly?</p>