Skip to content

Commit 24fafc2

Browse files
committed
Document that AOT processors are initialized during AOT processing
Closes gh-28866
1 parent 9413383 commit 24fafc2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanFactoryInitializationAotProcessor.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,25 @@
1616

1717
package org.springframework.beans.factory.aot;
1818

19+
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
1920
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
2021
import org.springframework.lang.Nullable;
2122

2223
/**
2324
* AOT processor that makes bean factory initialization contributions by
2425
* processing {@link ConfigurableListableBeanFactory} instances.
2526
*
27+
* <p>{@link BeanFactoryInitializationAotProcessor} implementations may be
28+
* registered in a {@value AotServices#FACTORIES_RESOURCE_LOCATION} resource or
29+
* as a bean.
30+
*
31+
* <p>
32+
* Note: Using this interface on a registered bean will cause the bean
33+
* <em>and</em> all of its dependencies to be initialized during AOT processing.
34+
* We generally recommend that interface is only used with infrastructure beans
35+
* such as {@link BeanFactoryPostProcessor} which have limited dependencies and
36+
* are already initialized early in the bean factory lifecycle.
37+
*
2638
* @author Phillip Webb
2739
* @author Stephane Nicoll
2840
* @since 6.0

spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotProcessor.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,24 @@
1616

1717
package org.springframework.beans.factory.aot;
1818

19+
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
1920
import org.springframework.beans.factory.support.RegisteredBean;
2021
import org.springframework.lang.Nullable;
2122

2223
/**
2324
* AOT processor that makes bean registration contributions by processing
2425
* {@link RegisteredBean} instances.
2526
*
27+
* <p>{@link BeanRegistrationAotProcessor} implementations may be registered in
28+
* a {@value AotServices#FACTORIES_RESOURCE_LOCATION} resource or as a bean.
29+
*
30+
* <p>
31+
* Note: Using this interface on a registered bean will cause the bean
32+
* <em>and</em> all of its dependencies to be initialized during AOT processing.
33+
* We generally recommend that interface is only used with infrastructure beans
34+
* such as {@link BeanFactoryPostProcessor} which have limited dependencies and
35+
* are already initialized early in the bean factory lifecycle.
36+
*
2637
* @author Phillip Webb
2738
* @since 6.0
2839
* @see BeanRegistrationAotContribution

0 commit comments

Comments
 (0)