InMemoryUserDetailsManager adds the username as the exception message for UsernameNotFoundException.
Outside of the context of this exception (for example when wrapped by another exception), the meaning of this message is harder to decipher.
Conventionally, Spring Security uses UsernameNotFoundException with a message like:
new UsernameNotFoundException("user '" + username + "' not found");
Making this change to InMemoryUserDetailsManager will make the exception message more informative and align it's behavior with the rest of Spring Security.