Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,18 @@
* with the {@code @Profile} annotation to provide two options of the same bean to the
* enclosing {@code @Configuration} class.
*
* <p>{@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.
*
* <h2>Configuring lazy initialization</h2>
*
* <p>By default, {@code @Bean} methods will be <em>eagerly instantiated</em> at container
Expand Down