I don’t have much idea of the aspects, so this may not help.
First, you need to ask yourself if you really need to distinguish between an incorrect username and an incorrect password, especially if this information is returned to the user.
spring -security , BadCredentialsException .
Spring security 3.0.x public authenticate() ( AbstractUserDetailsAuthenticationProvider), protected retrieveUser(), protected additionalAuthenticationChecks().
hideUserNotFoundExceptions false ( true), authenticate() UserNotFoundException ( ) BadCredentialsException .