title: Spring Boot Too Many Redirects
body: <p>I'm developing a simple login Form using a Thymeleaf &amp; Spring Boot. When i try hitting the following URL in Chrome: "<a href="http://localhost:8080/login" rel="noreferrer">http://localhost:8080/login</a>" i get an error saying "ERR_TOO_MANY_REDIRECTS". I've tried clearing my cache &amp; cookies in the browser and still get the same error.</p>
  
  <p>I tried disabling the default security login screen by putting the following property into my application.properties: <code>security.basic.enabled=false</code></p>
  
  <p>and added the following configuration to my SecurityConfig so any URL except "/login" and "/resources" would get authenticated:</p>
  
  <pre><code>@Configuration 
  @EnableWebSecurity
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Autowired 
      private UserRepository userRepository;
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
  
          http
          .authorizeRequests()
              .antMatchers("/resources/**").permitAll()
              .anyRequest().authenticated()
              .and()
          .formLogin()
              .loginPage("/login")
              .permitAll()
              .and()
          .logout()
              .permitAll();
      }
  </code></pre>
  
  <p>My LoginController is strightforward: </p>
  
  <pre><code>@Controller
  public class LoginController {
  
          @RequestMapping(value="/login", method=RequestMethod.GET)
          public String loadForm(Model model) {
              model.addAttribute("user", new User());
              return "redirect:/login";
          }
  </code></pre>
  
  <p>Anyone have any idea's why this happens?</p>