-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
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.