diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ConstructorParametersBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ConstructorParametersBinder.java index 3d73803df4fb..b5c98d0a7551 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ConstructorParametersBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ConstructorParametersBinder.java @@ -30,7 +30,6 @@ import kotlin.reflect.jvm.ReflectJvmMapping; import org.springframework.beans.BeanUtils; -import org.springframework.boot.context.properties.ConfigurationPropertyDefaultValue; import org.springframework.boot.context.properties.source.ConfigurationPropertyName; import org.springframework.core.KotlinDetector; import org.springframework.core.ResolvableType; @@ -153,8 +152,8 @@ private static Map parseParameters( Map parameters = new LinkedHashMap<>(); for (Parameter parameter : constructor.getParameters()) { String name = parameter.getName(); - ConfigurationPropertyDefaultValue[] annotationsByType = parameter - .getAnnotationsByType(ConfigurationPropertyDefaultValue.class); + DefaultValue[] annotationsByType = parameter + .getAnnotationsByType(DefaultValue.class); String[] defaultValue = (annotationsByType.length > 0) ? annotationsByType[0].value() : null; parameters.computeIfAbsent(name, diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertyDefaultValue.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultValue.java similarity index 92% rename from spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertyDefaultValue.java rename to spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultValue.java index c55d3e4e204a..5b5b3f9a4d5a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertyDefaultValue.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultValue.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.boot.context.properties; +package org.springframework.boot.context.properties.bind; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -31,7 +31,7 @@ @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.PARAMETER }) @Documented -public @interface ConfigurationPropertyDefaultValue { +public @interface DefaultValue { /** * The default value of the property. Can be an array of values for collection or diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java index 2374e493ee6c..38f51160b001 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java @@ -47,6 +47,7 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.boot.context.properties.bind.BindException; +import org.springframework.boot.context.properties.bind.DefaultValue; import org.springframework.boot.context.properties.bind.validation.BindValidationException; import org.springframework.boot.convert.DataSizeUnit; import org.springframework.boot.testsupport.rule.OutputCapture; @@ -1849,8 +1850,7 @@ static class ConstructorParameterProperties { private final int bar; - ConstructorParameterProperties( - @ConfigurationPropertyDefaultValue("hello") String foo, int bar) { + ConstructorParameterProperties(@DefaultValue("hello") String foo, int bar) { this.foo = foo; this.bar = bar; } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ConstructorParametersBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ConstructorParametersBinderTests.java index c9feb993dd62..35ebec520cf7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ConstructorParametersBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ConstructorParametersBinderTests.java @@ -21,7 +21,6 @@ import org.junit.Before; import org.junit.Test; -import org.springframework.boot.context.properties.ConfigurationPropertyDefaultValue; import org.springframework.boot.context.properties.source.ConfigurationPropertyName; import org.springframework.boot.context.properties.source.ConfigurationPropertySource; import org.springframework.boot.context.properties.source.MockConfigurationPropertySource; @@ -259,11 +258,9 @@ public static class ExampleDefaultValueBean { private final List customList; - public ExampleDefaultValueBean( - @ConfigurationPropertyDefaultValue("5") int intValue, - @ConfigurationPropertyDefaultValue({ "a", "b", - "c" }) List stringsList, - @ConfigurationPropertyDefaultValue("x,y,z") List customList) { + public ExampleDefaultValueBean(@DefaultValue("5") int intValue, + @DefaultValue({ "a", "b", "c" }) List stringsList, + @DefaultValue("x,y,z") List customList) { this.intValue = intValue; this.stringsList = stringsList; this.customList = customList;