title: Spring Security disable default login page
body: <p>I would like intergrate Spring Security in my rest API. I have problem because my configration blocing all routes. </p>
  
  <p>My configuration: </p>
  
  <pre><code>@Configuration
  @EnableResourceServer
  public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter {
  
      @Override
      public void configure(HttpSecurity http) throws Exception {
          http.csrf().disable();
          http.authorizeRequests()
                  .antMatchers("/").permitAll()
                  .antMatchers(HttpMethod.POST,"/api/getNews").hasRole("ADMIN");
      }
  }
  </code></pre>
  
  <p>When I want <code>GET</code> on <code>http://localhost:8080/</code> spring returns login form</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Login Page&lt;/title&gt;
      &lt;/head&gt;
      &lt;body onload='document.f.username.focus();'&gt;
          &lt;h3&gt;Login with Username and Password&lt;/h3&gt;
          &lt;form name='f' action='/login' method='POST'&gt;
              &lt;table&gt;
                  &lt;tr&gt;&lt;td&gt;User:&lt;/td&gt;&lt;td&gt;&lt;input type='text' name='username' value=''&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;tr&gt;&lt;td&gt;Password:&lt;/td&gt;&lt;td&gt;&lt;input type='password' name='password'/&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;tr&gt;&lt;td colspan='2'&gt;&lt;input name="submit" type="submit" value="Login"/&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;input name="_csrf" type="hidden" value="5453a3c5-2573-4861-b777-d008b04863c3" /&gt;
              &lt;/table&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But I have a rule for <code>/</code> to permit. Why I don't have access to my API?</p>