title: Spring Security /j_spring_security_check Not Found 404
body: <p>Here is my WebAppInitializer:</p>
  
  <pre><code>@Configuration
  public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
  
      @Override
      protected Class&lt;?&gt;[] getRootConfigClasses() {
          return new Class&lt;?&gt;[] { AppConfig.class, WebSecurityConfig.class };
      }
  
      @Override
      protected Class&lt;?&gt;[] getServletConfigClasses() {
          return new Class&lt;?&gt;[] { WebConfig.class };
      }
  
      @Override
      protected String[] getServletMappings() {
          return new String[] { "/" };
      }
  }
  </code></pre>
  
  <p>Here is my Security Config:</p>
  
  <pre><code>@Configuration
  @EnableWebSecurity
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Autowired
      private UserDetailsService userDetailsService;
  
      @Override
      protected void configure(AuthenticationManagerBuilder auth) throws Exception {
          auth.userDetailsService(userDetailsService);
      }
  
      @Override
      public void configure(WebSecurity web) throws Exception {
          web.ignoring().antMatchers("/resources/**");
      }
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          // @formatter:off
          http.authorizeRequests()
                  .antMatchers("/signup", "/about").permitAll()
                  .antMatchers("/admin/**").hasRole("ADMIN")
                  .anyRequest().authenticated()
                  .and().formLogin().loginPage("/login").defaultSuccessUrl("/home").failureUrl("/error").permitAll()
                  .and().httpBasic();
          // @formatter:on
      }
  
  }
  </code></pre>
  
  <p>And this is my login.html (example html from thymeleaf):</p>
  
  <pre><code>&lt;form th:action="@{/j_spring_security_check}" method="post"&gt;
    &lt;label for="j_username"&gt;Username&lt;/label&gt;:
    &lt;input type="text" id="j_username" name="j_username" /&gt; &lt;br /&gt;
  
    &lt;label for="j_password"&gt;Password&lt;/label&gt;:
    &lt;input type="password" id="j_password" name="j_password" /&gt; &lt;br /&gt;
  
    &lt;input type="submit" value="Log in" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>When i click on login, this error appears:</p>
  
  <pre><code>HTTP ERROR 404
  
  Problem accessing /j_spring_security_check. Reason:
  
      Not Found
  </code></pre>
  
  <p>How can i get rid of this error? I googled a lot, but no success yet. (Yes I do not use any xml.)</p>