Skip to content

Commit e749f30

Browse files
committed
Merge branch '2.7.x'
2 parents b403877 + 9028ab3 commit e749f30

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpression.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,11 @@
2727
/**
2828
* Configuration annotation for a conditional element that depends on the value of a SpEL
2929
* expression.
30+
* <p>
31+
* Referencing a bean in the expression will cause that bean to be initialized very early
32+
* in context refresh processing. As a result, the bean won't be eligible for
33+
* post-processing (such as configuration properties binding) and its state may be
34+
* incomplete.
3035
*
3136
* @author Dave Syer
3237
* @since 1.0.0

spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ This condition will not match for applications that are run with an embedded ser
143143
==== SpEL Expression Conditions
144144
The `@ConditionalOnExpression` annotation lets configuration be included based on the result of a {spring-framework-docs}/core.html#expressions[SpEL expression].
145145

146+
NOTE: Referencing a bean in the expression will cause that bean to be initialized very early in context refresh processing.
147+
As a result, the bean won't be eligible for post-processing (such as configuration properties binding) and its state may be incomplete.
148+
146149

147150

148151
[[features.developing-auto-configuration.testing]]

0 commit comments

Comments
 (0)