title: spring security does not redirect after successful login
body: <p>i use spring security 3.2.5 for user authentication. after i provide user name and password in login page it is not redirecting to page mentioned in defaultSuccessUrl method and it just reloads login page.</p>
  
  <p>following is my code please let me know what is wrong in this.</p>
  
  <pre><code>@Configuration
  @EnableWebMvcSecurity
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
  @Autowired
  private DataSource dataSource;
  
  @Override
  public void configure(WebSecurity webSecurity) throws Exception{
      webSecurity
          .ignoring()
              .antMatchers("/resources/**")
              .antMatchers(HttpMethod.POST, "/login");
  }
  
  @Override
  protected void configure(HttpSecurity http) throws Exception {
      http 
      .authorizeRequests()
      .anyRequest()
      .authenticated()
      .and()
              .formLogin()
                  .loginPage("/login")
                  .defaultSuccessUrl("/")
                  .failureUrl("/login?error=true")
                  //.usernameParameter("username").passwordParameter("password")
                  .permitAll()
              .and()
              .logout()
                  .logoutSuccessUrl("/login")
                  .permitAll()
              .and()
              .csrf();
  }
  
  @Override
  protected void configure(AuthenticationManagerBuilder auth)
          throws Exception {
      auth.jdbcAuthentication().dataSource(dataSource).usersByUsernameQuery(
              "SELECT user_id, password, 'true' as enabled FROM scl_user_info   WHERE user_id = ?");
  }
  }
  </code></pre>
  
  <p>login.jsp</p>
  
  <pre><code>&lt;form action="&lt;c:url value="/j_spring_security_check" /&gt;" method="POST"&gt;
     &lt;input type="text" class="form-control" placeholder="Username" name="j_username"/&gt;
     &lt;input type="password" class="form-control" placeholder="Password" name="j_password"/&gt;
     &lt;input type="checkbox" /&gt;
     &lt;span class="lbl"&gt; Remember Me&lt;/span&gt;
     &lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" /&gt;
     &lt;button type="submit" class="width-35 pull-right btn btn-sm btn-primary"&gt;
           &lt;i class="ace-icon fa fa-key"&gt;&lt;/i&gt;
           &lt;span class="bigger-110"&gt;Login&lt;/span&gt;
      &lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>HomeController</p>
  
  <pre><code> @Controller
   public class HomeController {
  
  @RequestMapping("/")
  public String defaultPage() {
      return "home";
  }
  
  @RequestMapping("/login")
  public String login(@RequestParam(value = "error", required = false) String error,
          @RequestParam(value = "logout", required = false) String logout) {
      return "login";
  }
  
  }
  </code></pre>
  
  <p>table columns </p>
  
  <p>id, user_id, password </p>