title: Spring Security 404 error
body: <p>I want to use spring security for authentification but when I try to access the site, I get the 404 error on all requests. I'm trying to debug this for few days, but nothing work for me.</p>
  
  <p>Here is my web.xml :</p>
  
  <pre><code>&lt;!-- Spring MVC --&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
          /WEB-INF/spring-database.xml,
          /WEB-INF/spring-security.xml
      &lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;!-- Spring Security --&gt;
  &lt;filter&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>spring-security.xml:</p>
  
  <pre><code>&lt;context:component-scan base-package="com.example.users.service"/&gt;
  
  &lt;http auto-config="true" use-expressions="true" authentication-manager-ref="authManager"&gt;
      &lt;intercept-url pattern="/j_spring_security_check" access="permitAll"/&gt;
      &lt;intercept-url pattern="/admin**" access="hasRole('ROLE_ADMIN')" /&gt;
  
      &lt;access-denied-handler error-page="/403" /&gt;
      &lt;form-login 
          login-page="/login" 
          default-target-url="/welcome"
          authentication-failure-url="/login?error" 
          username-parameter="username"
          password-parameter="password" /&gt;
      &lt;logout logout-success-url="/login?logout" /&gt;
      &lt;csrf /&gt;
  &lt;/http&gt;
  
  &lt;authentication-manager id="authManager"&gt;
      &lt;authentication-provider user-service-ref="myUserDetailsService" /&gt;
  &lt;/authentication-manager&gt;
  </code></pre>
  
  <p>spring-database.xml:</p>
  
  <pre><code>&lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
  &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt;
      &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
      &lt;property name="url" value="jdbc:mysql://localhost:3306/test" /&gt;
      &lt;property name="username" value="root" /&gt;
       &lt;property name="password" value="12345678" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="sessionFactory"
      class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/prop&gt;
              &lt;prop key="hibernate.format_sql"&gt;true&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
      &lt;property name="packagesToScan" value="com.example.users.model"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="transactionManager"
      class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>and mvc-dispatcher-servlet.xml:</p>
  
  <pre><code>&lt;context:component-scan base-package="com.example.*" /&gt;
  
  &lt;bean
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix"&gt;
          &lt;value&gt;/WEB-INF/pages/&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="suffix"&gt;
          &lt;value&gt;.jsp&lt;/value&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks.</p>