spring-projects / spring-projects/spring-framework

Invoke lifecycle methods in AOT mode in the same order as standard JVM mode

Open
#30,755 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core theme: aot type: enhancement
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:

https://github.com/spring-projects/spring-framework/blob/2ccf4cab8b4b437915c297be979d2e569fc273ef/spring-context/src/test/java/org/springframework/context/annotation/InitDestroyMethodLifecycleTests.java#L123-L143

AOT mode:

https://github.com/spring-projects/spring-framework/blob/2ccf4cab8b4b437915c297be979d2e569fc273ef/spring-context/src/test/java/org/springframework/context/annotation/InitDestroyMethodLifecycleTests.java#L170-L203

Known Issues

  • InitDestroyAnnotationBeanPostProcessor.processAheadOfTime(RegisteredBean) gets invoked twice in the same AOT processing phase: once via CommonAnnotationBeanPostProcessor and once via InitDestroyAnnotationBeanPostProcessor.
  • InitializingBean and DisposableBean are treated specially even in AOT mode.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.