spring-projects / spring-projects/spring-framework

Add support for refeshing a context for AOT processing with customized condition evaluation

Open
#35,499 1 comment 1 reaction 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

For Spring AOT to be more flexible, we'd like to record certain contributions without a locked-down BeanFactory. The most typical example is the handling of @Profile where we'd like to process them even though they may or may not be used at runtime.

The two immediate contenders here are: a (as much as possible) complete index for classpath scanning, and the build-time creation of CGLIB proxies.

Two things need to be improved to achieve this goals:

  • The Condition contract should be expanded with the notion of AOT processing where a condition can change its behavior based this new processing. Condition evaluation should offer a configurable option where this can be turned on
  • As additional bean definitions are filled in the BeanFactory bean names clash are going to be frequent. We should find a way to name those beans so that they can be inspected.

Spring AOT has a strong requirements that the classpath can't be changed. As such, @ConditionalOnClass (or any classpath-based condition) should opt-out of this new mechanism and always provide the same outcome. This will make sure we won't get a BeanDefinition in the bean factory for something that would obviously break if we tried to investigate its type.

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 by examining the Condition contract and the BeanFactory behavior described in the issue. Determine how configurable AOT-aware condition evaluation and inspectable names for additional bean definitions should work, while preserving stable outcomes for classpath-based conditions. Done means the proposed AOT processing can handle these contributions without changing the classpath assumptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
build-system, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.