-
Notifications
You must be signed in to change notification settings - Fork 6k
AlreadyBuiltException: This object has already been built #3916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @rwinch as I already mentioned on Gitter, here's my example of the problem, the latest commit is failing while the commit before that works: https://github.com/Turbots/data-jpa-preautorize-sample |
@davidkey Thanks for the comment. I'm trying to reproduce this and unable to. Can you provide exact steps for reproducing the issue? |
@Turbots Thanks for creating your sample. I was able to reproduce the issue using your sample. I'm going to break this out into a separate issue since I'd like to confirm your case separately. |
@rwinch Here's a gist with a full dump of what I'm seeing. Oddly, I was NOT able to reproduce the issue on travis-ci. Going to give it a shot on a seperate (windows) install on the same machine and see if I see the same behavior. Will report back shortly. |
Same PC, running Windows 10 (vs Ubuntu 16) and I do not experience the issue. Same versions of source code / dependencies / maven / java (if that even makes a difference?). Very strange. Perhaps some weird thread / prioritization issue? Let me know if there's anything else you'd like me to try. |
@davidkey Thanks for the fast response! I just pushed some fixes into master that may have fixed your issue. Perhaps the easiest thing would be for you to try running against the latest SNAPSHOT yourself? To do so you have two options:
In your project you can then define a property of: <properties>
<spring-security.version>4.1.1.BUILD-SNAPSHOT</spring-security.version>
</properties> If you could respond that your issue is fixed or not, that would be greatly appreciated! If it is not, we can continue to hunt for the issue. |
@rwinch Using the latest SNAPSHOT fixed it! Awesome - thanks! |
@davidkey Thanks for the fast report! Given your feedback I'm going to close this as fixed |
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.
The text was updated successfully, but these errors were encountered: