Add a note on early init with @ConditionalOnExpression

See gh-29276
This commit is contained in:
Mihail Cornescu 2022-01-05 18:03:29 +00:00 committed by Stephane Nicoll
parent bd2e992d48
commit fce3cd1684
2 changed files with 5 additions and 0 deletions

View File

@ -40,6 +40,10 @@ public @interface ConditionalOnExpression {
/**
* The SpEL expression to evaluate. Expression should return {@code true} if the
* condition passes or {@code false} if it fails.
* <p>
* NOTE: Referencing a bean in the expression will cause that bean to be initialized
* very early in context refresh processing. As a result, the bean will load with
* default property values.
* @return the SpEL expression
*/
String value() default "true";

View File

@ -143,6 +143,7 @@ This condition will not match for applications that are run with an embedded ser
==== SpEL Expression Conditions
The `@ConditionalOnExpression` annotation lets configuration be included based on the result of a {spring-framework-docs}/core.html#expressions[SpEL expression].
NOTE: Referencing a bean in the expression will cause that bean to be initialized very early in context refresh processing. As a result, the bean will load with default property values.
[[features.developing-auto-configuration.testing]]