From 7651d5841f5050bb6aa5e5a57013855221a08749 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Wed, 27 May 2026 11:58:56 +0200 Subject: [PATCH 1/3] Pin Node.js version to 24.15.0 Prior to this commit, the `antora` Gradle task silently failed to build the reference documentation, since Antora uses the latest LTS release for Node.js by default, and the latest LTS apparently does not work for us. --- framework-docs/framework-docs.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework-docs/framework-docs.gradle b/framework-docs/framework-docs.gradle index 83ab4ed43a9..a4cd3851a58 100644 --- a/framework-docs/framework-docs.gradle +++ b/framework-docs/framework-docs.gradle @@ -20,6 +20,10 @@ antora { ] } +node { + version = '24.15.0' +} + tasks.named("generateAntoraYml") { asciidocAttributes = project.provider( { return ["spring-version": project.version ] From f3bfe27445d3f5aa284ba211ca81e4bbf3d49b29 Mon Sep 17 00:00:00 2001 From: Dennis-Mircea Ciupitu Date: Sat, 23 May 2026 23:36:32 +0300 Subject: [PATCH 2/3] =?UTF-8?q?Document=20@=E2=81=A0Conditional=20gating?= =?UTF-8?q?=20of=20nested=20@=E2=81=A0Configuration=20classes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes gh-36831 Signed-off-by: Dennis-Mircea Ciupitu --- .../beans/java/composing-configuration-classes.adoc | 13 +++++++++++++ .../context/annotation/Configuration.java | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc b/framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc index 89257f072f5..d17e593f24a 100644 --- a/framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc +++ b/framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc @@ -610,6 +610,19 @@ Kotlin:: See the {spring-framework-api}/context/annotation/Conditional.html[`@Conditional`] javadoc for more detail. +[NOTE] +==== +A `@Conditional` declared on an enclosing `@Configuration` class gates the +registration of nested `@Configuration` classes within it only when the +nested class is reached through the parser's recursion from its enclosing +class, or through `@Import`. When the nested class is discovered +independently of its enclosing class, for example via `@ComponentScan` or +by directly registering it against the application context, it is processed +using only its own `@Conditional` annotations. In that case, redeclare the +relevant conditions on the nested class, or extract them into a composed +annotation applied to both, if the same gating is intended. +==== + [[beans-java-combining]] == Combining Java and XML Configuration diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java b/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java index 95d683ca359..9c0e20fcf40 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java @@ -341,6 +341,18 @@ import org.springframework.stereotype.Component; * with the {@code @Profile} annotation to provide two options of the same bean to the * enclosing {@code @Configuration} class. * + *

{@link Conditional @Conditional} annotations declared on an enclosing + * {@code @Configuration} class gate registration of any nested + * {@code @Configuration} classes within it when the nested class is reached + * through the parser's recursion from its enclosing class (the case shown + * above) or via {@link Import @Import}. When the nested class is discovered + * independently of its enclosing class, for example via + * {@link ComponentScan @ComponentScan} or by directly registering the nested + * class against the application context, it is processed using only its own + * {@code @Conditional} annotations. In that case, redeclare the relevant + * conditions on the nested class, or extract them into a composed + * annotation applied to both, if the same gating is intended. + * *

Configuring lazy initialization

* *

By default, {@code @Bean} methods will be eagerly instantiated at container From c17939ed5c177ecf4f848a5031b2e689ac908658 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Wed, 27 May 2026 11:39:17 +0200 Subject: [PATCH 3/3] Polish contribution See gh-36831 --- .../java/composing-configuration-classes.adoc | 18 +++++++-------- .../context/annotation/Configuration.java | 22 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc b/framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc index d17e593f24a..3bd4eaf272e 100644 --- a/framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc +++ b/framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc @@ -612,15 +612,15 @@ javadoc for more detail. [NOTE] ==== -A `@Conditional` declared on an enclosing `@Configuration` class gates the -registration of nested `@Configuration` classes within it only when the -nested class is reached through the parser's recursion from its enclosing -class, or through `@Import`. When the nested class is discovered -independently of its enclosing class, for example via `@ComponentScan` or -by directly registering it against the application context, it is processed -using only its own `@Conditional` annotations. In that case, redeclare the -relevant conditions on the nested class, or extract them into a composed -annotation applied to both, if the same gating is intended. +A `@Conditional` annotation declared on an enclosing `@Configuration` class is only +applied to the registration of a nested `@Configuration` class if the nested class is +reached through the parser's recursion from its enclosing class, or via `@Import`. If a +nested class is discovered independently of its enclosing class — for example, via +`@ComponentScan` or by directly registering it against the application context — it is +processed using only its own `@Conditional` annotations. Thus, if you wish to ensure that +the same `@Conditional` annotations apply in such scenarios, you must redeclare the +relevant annotations on the nested class, or extract them into a composed annotation +which you apply to both the enclosing class and the nested class. ==== diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java b/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java index 9c0e20fcf40..6be5fafc8b6 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java @@ -341,17 +341,17 @@ import org.springframework.stereotype.Component; * with the {@code @Profile} annotation to provide two options of the same bean to the * enclosing {@code @Configuration} class. * - *

{@link Conditional @Conditional} annotations declared on an enclosing - * {@code @Configuration} class gate registration of any nested - * {@code @Configuration} classes within it when the nested class is reached - * through the parser's recursion from its enclosing class (the case shown - * above) or via {@link Import @Import}. When the nested class is discovered - * independently of its enclosing class, for example via - * {@link ComponentScan @ComponentScan} or by directly registering the nested - * class against the application context, it is processed using only its own - * {@code @Conditional} annotations. In that case, redeclare the relevant - * conditions on the nested class, or extract them into a composed - * annotation applied to both, if the same gating is intended. + *

A {@link Conditional @Conditional} annotation declared on an enclosing + * {@code @Configuration} class is only applied to the registration of a nested + * {@code @Configuration} class if the nested class is reached through the parser's + * recursion from its enclosing class, or via {@link Import @Import}. If a nested + * class is discovered independently of its enclosing class — for example, + * via {@link ComponentScan @ComponentScan} or by directly registering it against + * the application context — it is processed using only its own + * {@code @Conditional} annotations. Thus, if you wish to ensure that the same + * {@code @Conditional} annotations apply in such scenarios, you must redeclare + * the relevant annotations on the nested class, or extract them into a composed + * annotation which you apply to both the enclosing class and the nested class. * *

Configuring lazy initialization

*