-
Notifications
You must be signed in to change notification settings - Fork 3.4k
AlreadyBuiltException: This object has already been built #189
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
Direct invocation also fails with the same error: |
I have a failing example in the following repository: https://github.com/Turbots/data-jpa-preautorize-sample Basically, when I autowire my CrudRepository in the main SpringBootApplication, there is some conflict in order of configurations it seems.. debugging this can be extremely confusing, but maybe that's just me :) |
@JanStureNielsen Thanks for the detailed report! This issue is a duplicate of:
The problem only manifests when Tomcat is started because Initializing the
So we have a Bean Cycle that is stopped by Spring Security detecting that @olivergierke - I'd recommend closing this issue as a duplicate of spring-projects/spring-security#3935 (this alone will fix the issue) If you want to ensure you have a test that behaves as it does when running you probably need an integration test (at least until spring-projects/spring-boot#6178 is fixed) |
On a related note, since the security docs state:
I'm wondering if Spring Boot could register a |
Thanks @philwebb I have considered changing the logic to eagerly initialize only configuration classes that have an with
|
Perhaps a simpler option is just to change the exception message in:
To hint that missing |
Works as of Spring Boot 2.2 snapshots. |
Building the
spring-projects/spring-data-examples
works fine but running thespring-projects/spring-data-examples/rest/security
with:fails with
AlreadyBuiltException
-- see below for stacktrace, environment, and dependencies.Environment
Failure stacktrace
Dependency tree
The text was updated successfully, but these errors were encountered: