Skip to content
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

Review default exclusion mechanism in AOT-optimized contexts #29280

Open
snicoll opened this issue Oct 7, 2022 · 0 comments
Open

Review default exclusion mechanism in AOT-optimized contexts #29280

snicoll opened this issue Oct 7, 2022 · 0 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: task A general task

Comments

@snicoll
Copy link
Member

snicoll commented Oct 7, 2022

Right now, we do the following:

  • If you implement BeanFactoryInitializationAotProcessor on a bean, it is excluded (with no way to have it back)
  • If you implement BeanRegistrationAotProcessor on a bean, it is excluded by default and that can changed by overriding the isBeanExcludedFromAotProcessing method
  • If you need to exclude additional components, you need to implement BeanRegistrationExcludeFilter. Such interface must be implemented with either BeanFactoryInitializationAotProcessor or BeanRegistrationAotProcessor.

The shortcut for "exclude myself" on BeanRegistrationAotProcessor is quite handy so I don't think relying only on the filter in its current form is ok. However, we should probably consider renaming the method as it doesn't exactly state what it does right now (the bean is processed and its contribution is recorded, but the bean itself won't be registered).

spring-projects/spring-boot#32542 is another example. We have a BeanDefinitionRegistryPostProcessor that's exposed as a bean. The outcome of the post-processor (registering bean definitions) is recorded by AOT but the bean itself is contributed. This means that at runtime those bean definitions are contributed again.

Excluding them by default might not be the best option as they could potentially implement extra interface and having them excluded with no signal can be quite misleading.

@snicoll snicoll added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 7, 2022
@snicoll snicoll transferred this issue from spring-projects/spring-boot Oct 7, 2022
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Jan 24, 2023
@snicoll snicoll added the theme: aot An issue related to Ahead-of-time processing label Oct 2, 2023
@snicoll snicoll added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 21, 2023
@snicoll snicoll added this to the 6.2.x milestone Dec 21, 2023
@jhoeller jhoeller modified the milestones: 6.2.x, General Backlog Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: task A general task
Projects
None yet
Development

No branches or pull requests

3 participants