Closed
Description
Describe the bug
I'm overriding the authenticationManager method from the WebSecurityConfigurerAdapter in order to create its bean, howerver whenever I try to turn the spring context up (in a test annotated with a @SpringBootTest for example), I get either a StackOverflowError or OutOfMemoryError. I tracked this error to the authenticationManager method, because whenever I remove the @bean annotation the error disappears.
I'm using gradle, Java 11 and spring-boot-starter-security version 2.5.6
To Reproduce
- Override the authenticationManager from the WebSecurityConfigurerAdapter class and add a Bean annotation
- Try to run a test annotated with SpringBootTest
@EnableWebSecurity
@Configuration
public class SecurityConfigurations extends WebSecurityConfigurerAdapter {
@Bean
@Override
protected AuthenticationManager authenticationManager() throws Exception {
return super.authenticationManager();
}
...
Expected behavior
Being able to run the app and inject the authenticationManager bean
Sample
https://github.com/mmorillodev/stackoverflow-error-sample