InjectionMetadata provides some information we could use at build-time. For instance, if AutowiredAnnotationBeanPostProcessor is enabled for the ApplicationContext that app uses without AOT, we should be able to find out about autowired elements, potentially even reusing any custom configuration that was set on the post processor.

There is also some logic in the way injection works that we may need to streamline to be consistent.

Comment From: snicoll

We're trying to design an interface that allows a BeanPostProcessor to opt-in for providing a code contributor that replaces what it does at runtime. The current model is implementing an interface that returns a contributor based on a RootBeanDefinition, similar to MergedBeanDefinitionPostProcessor#postProcessMergedBeanDefinition.

While the processor would be excluded by default at runtime, it would be nice if it could indicate that it needs to run again. If we want such a feature, the phase at which the BeanFactory is processed should become a high-level concept, something like "build-time" vs. "runtime" vs. "optimized-runtime".

Comment From: snicoll

We need #28047 to move forward on this one.