diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 3e69a2700fa..dee6e0cb88a 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -634,6 +634,9 @@ Nested POJO properties can also be created (so a setter is not mandatory) if the default constructor, or a constructor accepting a single value that can be coerced from String. Some people use Project Lombok to add getters and setters automatically. +TIP: Contrary to `@Value`, SpEL expressions are not evaluated prior to injecting a value +in the relevant `@ConfigurationProperties` bean as said value is usually externalized. + The `@EnableConfigurationProperties` annotation is automatically applied to your project so that any beans annotated with `@ConfigurationProperties` will be configured from the `Environment` properties. This style of configuration works particularly well with the diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java index d21c6bbb5f8..7dba2098418 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java @@ -26,6 +26,9 @@ import java.lang.annotation.Target; * Annotation for externalized configuration. Add this to a class definition or a * {@code @Bean} method in a {@code @Configuration} class if you want to bind and validate * some external Properties (e.g. from a .properties file). + *
+ * Note that contrary to {@code @Value}, SpEL expressions are not evaluated since property + * values are externalized. * * @author Dave Syer * @see ConfigurationPropertiesBindingPostProcessor