Skip to content

Commit

Permalink
Merge pull request #29276 from mihailcornescu
Browse files Browse the repository at this point in the history
* pr/29276:
  Polish "Add a note on early init with @ConditionalOnExpression"
  Add a note on early init with @ConditionalOnExpression

Closes gh-29276
  • Loading branch information
snicoll committed Feb 1, 2022
2 parents bd2e992 + 5fe6176 commit 30e927a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,11 @@
/**
* Configuration annotation for a conditional element that depends on the value of a SpEL
* expression.
* <p>
* Referencing a bean in the expression will cause that bean to be initialized very early
* in context refresh processing. As a result, the bean won't be eligible for
* post-processing (such as configuration properties binding) and its state may be
* incomplete.
*
* @author Dave Syer
* @since 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ 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 won't be eligible for post-processing (such as configuration properties binding) and its state may be incomplete.



[[features.developing-auto-configuration.testing]]
Expand Down

0 comments on commit 30e927a

Please sign in to comment.