Top Description Methods
org.springframework.beans.factory.aot

public Interface BeanRegistrationAotProcessor

Known Direct Implementers
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor, org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor
Annotations
@FunctionalInterface
Imports
org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.support.RegisteredBean, org.springframework.lang.Nullable

AOT processor that makes bean registration contributions by processing RegisteredBean instances.

BeanRegistrationAotProcessor implementations may be registered in a META-INF/spring/aot.factories resource or as a bean.

Using this interface on a registered bean will cause the bean and all of its dependencies to be initialized during AOT processing. We generally recommend that this interface is only used with infrastructure beans such as BeanPostProcessor which have limited dependencies and are already initialized early in the bean factory lifecycle. If such a bean is registered using a factory method, make sure to make it static so that its enclosing class does not have to be initialized.

An AOT processor replaces its usual runtime behavior by an optimized arrangement, usually in generated code. For that reason, a component that implements this interface is not contributed by default. If a component that implements this interface still needs to be invoked at runtime, isBeanExcludedFromAotProcessing can be overridden.

Authors
Phillip Webb, Stephane Nicoll
Since
6.0
See Also
BeanRegistrationAotContribution

Method Summary

Modifier and TypeMethod and Description
public default boolean

Returns:

if the bean should be excluded from AOT processing
isBeanExcludedFromAotProcessing
()

Return if the bean instance associated with this processor should be excluded from AOT processing itself.

public BeanRegistrationAotContribution
processAheadOfTime(RegisteredBean
the registered bean to process
registeredBean
)

Process the given RegisteredBean instance ahead-of-time and return a contribution or null.

Method Detail

isBeanExcludedFromAotProcessingback to summary
public default boolean isBeanExcludedFromAotProcessing()

Return if the bean instance associated with this processor should be excluded from AOT processing itself. By default, this method returns true to automatically exclude the bean, if the definition should be written then this method may be overridden to return true.

Returns:boolean

if the bean should be excluded from AOT processing

See Also
BeanRegistrationExcludeFilter
processAheadOfTimeback to summary
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean)

Process the given RegisteredBean instance ahead-of-time and return a contribution or null.

Processors are free to use any techniques they like to analyze the given instance. Most typically use reflection to find fields or methods to use in the contribution. Contributions typically generate source code or resource files that can be used when the AOT optimized application runs.

If the given instance isn't relevant to the processor, it should return a null contribution.

Parameters
registeredBean:RegisteredBean

the registered bean to process

Returns:BeanRegistrationAotContribution

a BeanRegistrationAotContribution or null

Annotations
@Nullable