Add Bean instantiation generator infrastructure #28047
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
theme: aot
An issue related to Ahead-of-time processing
type: enhancement
A general enhancement
Milestone
As part of our AOT effort, we need an infrastructure that lets us generate the code to instantiate a bean.
This includes some low-level code generation infrastructure to write method calls, parameters, etc, as well as an API that can be used to contribute to the bean instance.
Such contributors should namely be based on the existing
BeanPostProcessor
infrastructure as they augment a bean instance with some logic that can be translated into code during the AOT phase. As BPP are ordered, so can their contributions so that the order in which they are applied by executing generated code matches.To ease code generation, we need an infrastructure that focuses on something quite basic for a first version, something like:
This registeres a
restTemplateClientService
bean that requires aRestTemplateBuilder
. Rather than doing all the dependency resolution at build-time, we leverage framework's dependency resolution algorithm, via theinstanceContext
who can provide us resolved attributes according toExecutable
to use to instantiate the bean (here a constructor that takes aRestTemplateBuilder
).The text was updated successfully, but these errors were encountered: