Skip to content

Add option to ignore bean registration with AOT #33243

@snicoll

Description

@snicoll

When an ApplicationContext is optimized by Spring AOT, there are a number of limitations. One of them is that the bean registration cannot use an instance supplier as it isn't possible for AOT to generate a bean registration that calls it.

#29555 is a concrete example of this problem where the use of the Kotlin DSL makes it so that it fails out of-the-box.

Certain callbacks are execute twice at the moment, once when the context is created ahead-of-time for it to be processed and once more at runtime because the component has been registered. When we have this flexibility, it would be nice to instruct AOT to ignore the bean registration. Adding something like AOT_PROCESSING_IGNORE_REGISTRATION on the bean definition could do it.

This way the bean definition won't be contributed and won't suffer that limitation. At runtime, the callback that is invoked would create the bean.

Metadata

Metadata

Assignees

Labels

theme: aotAn issue related to Ahead-of-time processingtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions