Document that AOT processors are initialized during AOT processing

Closes gh-28866
This commit is contained in:
Phillip Webb 2022-07-28 14:01:45 +01:00
parent 9413383d72
commit 24fafc2fb7
2 changed files with 23 additions and 0 deletions

View File

@ -16,6 +16,7 @@
package org.springframework.beans.factory.aot; package org.springframework.beans.factory.aot;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
@ -23,6 +24,17 @@ import org.springframework.lang.Nullable;
* AOT processor that makes bean factory initialization contributions by * AOT processor that makes bean factory initialization contributions by
* processing {@link ConfigurableListableBeanFactory} instances. * processing {@link ConfigurableListableBeanFactory} instances.
* *
* <p>{@link BeanFactoryInitializationAotProcessor} implementations may be
* registered in a {@value AotServices#FACTORIES_RESOURCE_LOCATION} resource or
* as a bean.
*
* <p>
* Note: Using this interface on a registered bean will cause the bean
* <em>and</em> all of its dependencies to be initialized during AOT processing.
* We generally recommend that interface is only used with infrastructure beans
* such as {@link BeanFactoryPostProcessor} which have limited dependencies and
* are already initialized early in the bean factory lifecycle.
*
* @author Phillip Webb * @author Phillip Webb
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 6.0 * @since 6.0

View File

@ -16,6 +16,7 @@
package org.springframework.beans.factory.aot; package org.springframework.beans.factory.aot;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.support.RegisteredBean; import org.springframework.beans.factory.support.RegisteredBean;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
@ -23,6 +24,16 @@ import org.springframework.lang.Nullable;
* AOT processor that makes bean registration contributions by processing * AOT processor that makes bean registration contributions by processing
* {@link RegisteredBean} instances. * {@link RegisteredBean} instances.
* *
* <p>{@link BeanRegistrationAotProcessor} implementations may be registered in
* a {@value AotServices#FACTORIES_RESOURCE_LOCATION} resource or as a bean.
*
* <p>
* Note: Using this interface on a registered bean will cause the bean
* <em>and</em> all of its dependencies to be initialized during AOT processing.
* We generally recommend that interface is only used with infrastructure beans
* such as {@link BeanFactoryPostProcessor} which have limited dependencies and
* are already initialized early in the bean factory lifecycle.
*
* @author Phillip Webb * @author Phillip Webb
* @since 6.0 * @since 6.0
* @see BeanRegistrationAotContribution * @see BeanRegistrationAotContribution