title: Spring Security Configuration is not applied
body: <p>I have the below configuration where i need to configure <code>HTTPBasic</code> authentication for <code>/api/v1/**</code> endpoints and i want to configure <code>form</code> authentication for <code>/users/</code> url pattern. When i run with the below configuration, the configuration for web requests is working correctly but the configuration for API is not working. No security is being applied. Where am I going wrong?</p>
  
  <pre><code>@Configuration
  @EnableWebSecurity
  public class WebSecurityConfig {
  
      @Order(1)
      @Configuration
      public static class MVCSecurityConfiguration extends WebSecurityConfigurerAdapter {
  
          @Bean
          public BCryptPasswordEncoder getBCryptPasswordEncoder() {
              return new BCryptPasswordEncoder();
          }
  
          @Override
          protected void configure(HttpSecurity http) throws Exception {
              http.
                      antMatcher("/users/**")
                      .csrf()
                          .and()
                      .authorizeRequests()
                      .antMatchers(
                              "/resources/**", "/users/register", "/users/signup", "/users/confirm", "/users/user-action", "/users/reset-password", "/confirm", "/webjars/**")
                      .permitAll()
                      .antMatchers("/users/**")
                      .hasRole("USER")
                      .anyRequest()
                      .authenticated()
                      .and()
                      .formLogin().loginPage("/login").usernameParameter("username").passwordParameter("password");
  
              http
                      .authorizeRequests()
                      .antMatchers("/api/v1/users/**")
                      .hasRole("USER")
                      .anyRequest()
                      .authenticated()
                      .and()
                      .httpBasic();
          }
      }
  </code></pre>