-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
From #3825 (comment)
I had the same issue.
I was wiring a custom AuthenticationSuccessHandler into my security configuration that indirectly referenced a @service bean with an @Autowired reference to AuthenticationManager. After some thought, I'm surprised it worked - but no problems at all at runtime! Perhaps some sort of wiring order / race condition helped me out? However, while running the same vacuous test mentioned by @whittle, I encountered the dreaded AlreadyBuiltException.
Note that in a very stripped down version of my application I was debugging this issue with, I did receive a BeanCurrentlyInCreationException on AuthenticationManager but only during testing - not at runtime. Not exactly the same issue, but could be related behavior. See here: https://github.com/davidkey/SecurityTestErrorPOC.
My fix was to add @lazy to my AuthenticationSuccessHandler in my security configuration while I rethink my architecture a bit.
HTH.