Skip to content

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

Description

@snicoll

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)theme: aotAn issue related to Ahead-of-time processingtype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions