diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanFactoryInitializationAotProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanFactoryInitializationAotProcessor.java index 875126a4947..b0c12743d35 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanFactoryInitializationAotProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanFactoryInitializationAotProcessor.java @@ -16,6 +16,7 @@ package org.springframework.beans.factory.aot; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.lang.Nullable; @@ -23,6 +24,17 @@ import org.springframework.lang.Nullable; * AOT processor that makes bean factory initialization contributions by * processing {@link ConfigurableListableBeanFactory} instances. * + *
{@link BeanFactoryInitializationAotProcessor} implementations may be + * registered in a {@value AotServices#FACTORIES_RESOURCE_LOCATION} resource or + * as a bean. + * + *
+ * Note: 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 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 Stephane Nicoll * @since 6.0 diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotProcessor.java index 044b68aeb91..ef0b3b0e590 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotProcessor.java @@ -16,6 +16,7 @@ package org.springframework.beans.factory.aot; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.support.RegisteredBean; import org.springframework.lang.Nullable; @@ -23,6 +24,16 @@ import org.springframework.lang.Nullable; * AOT processor that makes bean registration contributions by processing * {@link RegisteredBean} instances. * + *
{@link BeanRegistrationAotProcessor} implementations may be registered in + * a {@value AotServices#FACTORIES_RESOURCE_LOCATION} resource or as a bean. + * + *
+ * Note: 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 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 * @since 6.0 * @see BeanRegistrationAotContribution