From f94caed7e918c8e6a4f52ec40187393278218fe6 Mon Sep 17 00:00:00 2001 From: Susmitha Date: Fri, 1 Oct 2021 10:16:40 -0700 Subject: [PATCH] Update ConstructorBinding javadoc with usage information See gh-28168 --- .../boot/context/properties/ConstructorBinding.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConstructorBinding.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConstructorBinding.java index 43c1bd8d09cf..cbd19bbe4a9c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConstructorBinding.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConstructorBinding.java @@ -26,6 +26,14 @@ * Annotation that can be used to indicate that configuration properties should be bound * using constructor arguments rather than by calling setters. Can be added at the type * level (if there is an unambiguous constructor) or on the actual constructor to use. + *

+ * Note: To use constructor binding the class must be enabled using + * {@link EnableConfigurationProperties @EnableConfigurationProperties} or configuration + * property scanning. Constructor binding cannot be used with beans that are created by + * the regular Spring mechanisms (e.g. + * {@link org.springframework.stereotype.Component @Component} beans, beans created via + * {@link org.springframework.context.annotation.Bean @Bean} methods or beans loaded using + * {@link org.springframework.context.annotation.Import @Import}). * * @author Phillip Webb * @since 2.2.0