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
Add support for private
init/destroy methods in AOT mode
#30654
Conversation
@essobedo Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
private
init/destroy methods in AOT mode
private
init/destroy methods in AOT modeprivate
init/destroy methods in AOT mode
Hi @essobedo, Congratulations on submitting your first PR to the Spring Framework! 👍
I'm not certain that this is the correct approach to this issue. I believe we may need to keep the fully-qualified method name in order to support multiple In light of that, I have marked this PR as a draft to allow us to further investigate the issue. Related Issues |
@sbrannen I understand, I was wondering if I should go beyond or not, but my idea was just to reduce the limitations with very limited impact. Let me try to cover all use cases. Thank you for your quick feedback. |
@essobedo how is it going? Do you need help? |
FYI: I am already looking into this issue, and I think I will be taking a different approach to addressing this. |
Can we please close it to avoid duplicated efforts? |
Sorry, I had to finish something else first, I planned to work on it tomorrow but if you are already working on it feel free to close it |
Motivation
In AOT mode, if the init/destroy methods are private and auto-discovered thanks to an annotation, the generated code sets the init and destroy method names with the fully qualified name of the declaring class as prefix to prevent naming conflicts which causes an error of the following type when starting the application (native image or with
-Dspring.aot.enabled=true
):Steps to reproduce:
Configuration class:
Bean class:
Modifications:
LifecycleElement
even if it won't solve the potential naming conflict but it is a more specific use caseResult
The init and destroy methods are called when starting the application (native image or with
-Dspring.aot.enabled=true
).