I have been following the Spring Security Reference and i added only this classes:
@Configuration
@EnableWebMvcSecurity
public class WebSecurityConfig extend
I had the same problem. I fixed it deleting http.antMatchers("").The problem was "" - SpringSecurityFilterChain throws an error, because pattern could not be empty or null.
I copied your spring security configuration and was able to reproduce the error.
Following line in the stacktrace gives the root cause of the exception:
at org.springframework.security.provisioning.InMemoryUserDetailsManager.createUser(InMemoryUserDetailsManager.java:59)
In InMemoryUserDetailsManager class, createUser() method, Spring checks if the user exists before creating an user. In your case you are adding two user with same username, hence there is an IllegalArgumentException.
I added two users with different usernames and it started working fine.