title: Allow access to url pattern only for a specific role in spring security
body: <p>I'm trying to allow only users that have role 'ADMIN' to access following endpoints:</p>
  
  <p>../adminconfig/* (those that have 'adminconfig' in the url)</p>
  
  <p>Here is my configuration:</p>
  
  <pre><code>@SpringBootApplication
  @EnableWebSecurity
  @RestController
  public class BootApplication extends WebSecurityConfigurerAdapter {
  
  
      public static void main(String[] args) {
          SpringApplication.run(BootApplication.class, args);
      }
  
      @Autowired
      public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
          auth
                  .inMemoryAuthentication()
                  .withUser("user").password("{noop}1").roles("USER").and()
                  .withUser("admin").password("{noop}1").roles("ADMIN");
      }
  
      @Override
      protected void configure(HttpSecurity http) throws Exception{
  
          http
                  .authorizeRequests()
  
                  .anyRequest().authenticated()
                  .antMatchers("/adminconfig/**").hasRole("ADMIN")
                  .and()
                  .formLogin().and()
                  .httpBasic();
      }
  
  }
  </code></pre>
  
  <p>But still  i can access them with any other user, for example with 'USER' role. What am i doing wrong?</p>