Interface BeanRegistrationAotProcessor
- All Known Implementing Classes:
AutowiredAnnotationBeanPostProcessor
,CommonAnnotationBeanPostProcessor
,ConfigurationClassPostProcessor
,InitDestroyAnnotationBeanPostProcessor
,PersistenceAnnotationBeanPostProcessor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
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.
- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Return if the bean instance associated with this processor should be excluded from AOT processing itself.processAheadOfTime
(RegisteredBean registeredBean) Process the givenRegisteredBean
instance ahead-of-time and return a contribution ornull
.
-
Method Details
-
processAheadOfTime
Process the givenRegisteredBean
instance ahead-of-time and return a contribution ornull
.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
- the registered bean to process- Returns:
- a
BeanRegistrationAotContribution
ornull
-
isBeanExcludedFromAotProcessing
default boolean isBeanExcludedFromAotProcessing()Return if the bean instance associated with this processor should be excluded from AOT processing itself. By default, this method returnstrue
to automatically exclude the bean, if the definition should be written then this method may be overridden to returntrue
.- Returns:
- if the bean should be excluded from AOT processing
- See Also:
-