-
Notifications
You must be signed in to change notification settings - Fork 38.1k
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
AOT registers BeanDefinitionRegistryPostProcessor beans causing duplication of configuration #30411
Comments
Looks like related to #29484 and something we should potentially improve in Spring Framework 6.1. For your use case, in order to avoid the use of |
Most of our actual implementations do that already. We're also trying to avoid the overhead of running the processors at all: We also have |
I think what will come up from #29484 should be usable for user implementation as well, maybe you could comment on it to bring this need to the attention of the team and we close this one as duplicate? |
@DanielThomas thanks for the report. We haven't really made up our mind on I'd like this one to be kept open so that we can do an overview of our own implementations. |
I did a bit of searching in the codebase to at least what Spring Boot integrates with directly. Post processors disabled with
|
Related #30372 |
AOT retains registrations of
BeanDefinitionRegistryPostProcessor
beans, causing them to run again under AOT. Other than meaning you don't realise the benefits of avoidance of post-processing, if those processors register definitions unconditionally they fail with:Appears that Boot is handling this conditionally in several places with
AotDetector
, but that appears to be explicitly for internal use.In this specific case, it feels like AOT should filter the registrations, but what's the recommendation for similar patterns in end-user implementations?
spring-framework/spring-core/src/main/java/org/springframework/aot/AotDetector.java
Lines 22 to 29 in c1014f5
Example project:
https://github.com/DanielThomas/spring-aot-issues/tree/dannyt/post-processor-duplicate
Run and note the failure:
The text was updated successfully, but these errors were encountered: