Skip to content

Commit c17939e

Browse files
committed
Polish contribution
See gh-36831
1 parent f3bfe27 commit c17939e

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -612,15 +612,15 @@ javadoc for more detail.
612612

613613
[NOTE]
614614
====
615-
A `@Conditional` declared on an enclosing `@Configuration` class gates the
616-
registration of nested `@Configuration` classes within it only when the
617-
nested class is reached through the parser's recursion from its enclosing
618-
class, or through `@Import`. When the nested class is discovered
619-
independently of its enclosing class, for example via `@ComponentScan` or
620-
by directly registering it against the application context, it is processed
621-
using only its own `@Conditional` annotations. In that case, redeclare the
622-
relevant conditions on the nested class, or extract them into a composed
623-
annotation applied to both, if the same gating is intended.
615+
A `@Conditional` annotation declared on an enclosing `@Configuration` class is only
616+
applied to the registration of a nested `@Configuration` class if the nested class is
617+
reached through the parser's recursion from its enclosing class, or via `@Import`. If a
618+
nested class is discovered independently of its enclosing class — for example, via
619+
`@ComponentScan` or by directly registering it against the application context — it is
620+
processed using only its own `@Conditional` annotations. Thus, if you wish to ensure that
621+
the same `@Conditional` annotations apply in such scenarios, you must redeclare the
622+
relevant annotations on the nested class, or extract them into a composed annotation
623+
which you apply to both the enclosing class and the nested class.
624624
====
625625

626626

spring-context/src/main/java/org/springframework/context/annotation/Configuration.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,17 @@
341341
* with the {@code @Profile} annotation to provide two options of the same bean to the
342342
* enclosing {@code @Configuration} class.
343343
*
344-
* <p>{@link Conditional @Conditional} annotations declared on an enclosing
345-
* {@code @Configuration} class gate registration of any nested
346-
* {@code @Configuration} classes within it when the nested class is reached
347-
* through the parser's recursion from its enclosing class (the case shown
348-
* above) or via {@link Import @Import}. When the nested class is discovered
349-
* independently of its enclosing class, for example via
350-
* {@link ComponentScan @ComponentScan} or by directly registering the nested
351-
* class against the application context, it is processed using only its own
352-
* {@code @Conditional} annotations. In that case, redeclare the relevant
353-
* conditions on the nested class, or extract them into a composed
354-
* annotation applied to both, if the same gating is intended.
344+
* <p>A {@link Conditional @Conditional} annotation declared on an enclosing
345+
* {@code @Configuration} class is only applied to the registration of a nested
346+
* {@code @Configuration} class if the nested class is reached through the parser's
347+
* recursion from its enclosing class, or via {@link Import @Import}. If a nested
348+
* class is discovered independently of its enclosing class &mdash; for example,
349+
* via {@link ComponentScan @ComponentScan} or by directly registering it against
350+
* the application context &mdash; it is processed using only its own
351+
* {@code @Conditional} annotations. Thus, if you wish to ensure that the same
352+
* {@code @Conditional} annotations apply in such scenarios, you must redeclare
353+
* the relevant annotations on the nested class, or extract them into a composed
354+
* annotation which you apply to both the enclosing class and the nested class.
355355
*
356356
* <h2>Configuring lazy initialization</h2>
357357
*

0 commit comments

Comments
 (0)