There are a lot of reports about a StackOverflowError when exposing the AuthenticationManager as a bean and using it inside a custom authentication mechanism.
This ticket should be used to centralize the reports and provide any feedback during the analysis.
See: - https://github.com/spring-projects/spring-security/issues/11609 - https://github.com/spring-projects/spring-security/issues/10419 - https://github.com/spring-projects/spring-security/issues/10822#issuecomment-1141121007 - https://github.com/spring-projects/spring-security/issues/8369 - https://github.com/spring-projects/spring-security/pull/11071 - https://stackoverflow.com/questions/73892406/already-existing-securityfilterchain-is-preventing-my-configuration-on-spring-se/73895991#73895991 - https://stackoverflow.com/questions/74633891/spring-boot-microservices-spring-security-servicetest-and-controllertest-for - https://stackoverflow.com/questions/74694980/authenticationmanager-authenticate-throws-java-lang-stackoverflowerror-null-w
Comment From: marcusdacoregio
This answer on Stackoverflow might help to design a fix for that.
Comment From: marcusdacoregio
I'll close this in favor of https://github.com/spring-projects/spring-security/issues/11926, if needed we can reopen.