spring-projects / spring-projects/spring-framework
Invoke lifecycle methods in AOT mode in the same order as standard JVM mode
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 60.2k
- Forks
- 38.8k
- Avg merge
- 5d 2h
- Merged PRs (30d)
- 27
Description
Overview
The difference in invocation order between standard JVM mode and AOT mode can be viewed in the following tests. See also: https://github.com/spring-projects/spring-framework/pull/30724#issuecomment-1602534343.
Tests
JVM mode:
AOT mode:
Known Issues
InitDestroyAnnotationBeanPostProcessor.processAheadOfTime(RegisteredBean)gets invoked twice in the same AOT processing phase: once viaCommonAnnotationBeanPostProcessorand once viaInitDestroyAnnotationBeanPostProcessor.InitializingBeanandDisposableBeanare treated specially even in AOT mode.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with spring-context/src/test/java/org/springframework/context/annotation/InitDestroyMethodLifecycleTests.java, comparing the JVM-mode lines 123-143 with the AOT-mode lines 170-203. Then inspect InitDestroyAnnotationBeanPostProcessor.processAheadOfTime(RegisteredBean) and the listed special handling; done means lifecycle methods are invoked in the same order in both modes without the known duplicate processing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100