I made a login system with Spring Security. This is my spring-security.xml
...
This is an old question, but since the answer marked as correct actually contains a nasty subtle bug it should be noted that the correct solution would be to use built-in ExceptionMappingAuthenticationFailureHandler
instead of the CustomAuthenticationFailureHandler
suggested in the answer from @mdp.