Recently I have been teaching myself Spring MVC using the book “Spring MVC: Beginners Guide” by G, Amuthan. The book does not focus on the version of Spring that I am using so maybe there are some changes in the more recent version of Spring.
Chapter 4 has an example to add a custom login form using the spring security framework. The example secures a specific page in our case /products/add/
However after implementing the example I would continuously get a 404 error from Tomcat after submitting the login form. The 404 error was for the path /j_spring_security_check. After some research I finally found the answer on Stackoverflow http://stackoverflow.com/questions/24321169/no-mapping-found-for-http-request-with-uri-pms-j-spring-security-check-in-dis
The missing part of the puzzle was in the security-context.xml file. It appears you must specifically define the login-processing-url within the form-login element.
<security:form-login login-page="/login" default-target-url="/products/add" authentication-failure-url="/loginfailed" login-processing-url="/j_spring_security_check" />