From eac712596d765d6e95a5edf2b61971e573fb5c1e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 24 Apr 2026 20:09:47 -0700 Subject: [PATCH] Add public constructor that accepts a cause Add a public constructor to `InvalidConfigurationPropertyValueException` that accepts a cause. Closes gh-50211 --- .../InvalidConfigurationPropertyValueException.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/InvalidConfigurationPropertyValueException.java b/core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/InvalidConfigurationPropertyValueException.java index ef9612366db..51a6370444f 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/InvalidConfigurationPropertyValueException.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/InvalidConfigurationPropertyValueException.java @@ -48,7 +48,18 @@ public class InvalidConfigurationPropertyValueException extends RuntimeException this(name, value, reason, null); } - InvalidConfigurationPropertyValueException(String name, @Nullable Object value, @Nullable String reason, + /** + * Creates a new instance for the specified property {@code name} and {@code value}, + * including a {@code reason} why the value is invalid. + * @param name the name of the property in canonical format + * @param value the value of the property, can be {@code null} + * @param reason a human-readable text that describes why the reason is invalid. + * Starts with an upper-case and ends with a dot. Several sentences and carriage + * returns are allowed. + * @param cause the cause of the exception or {@code null} + * @since 4.1.0 + */ + public InvalidConfigurationPropertyValueException(String name, @Nullable Object value, @Nullable String reason, @Nullable Throwable cause) { super("Property " + name + " with value '" + value + "' is invalid: " + reason, cause); Assert.notNull(name, "'name' must not be null");