The error is most likely caused by declaring the AuthenticationManager as a @Bean
. Try this in your test class:
@MockBean
private AuthenticationManager _authenticationManager;
That said, the Spring Security team does not recommend exposing the AuthenticationManager in this way, see the comment in Spring issue #29215