diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java index b799aa0080..9e536df9df 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java @@ -32,7 +32,6 @@ import org.springframework.boot.context.properties.source.IterableConfigurationP import org.springframework.core.ResolvableType; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; -import org.springframework.util.StringUtils; /** * Base class for {@link AggregateBinder AggregateBinders} that read a sequential run of @@ -90,7 +89,7 @@ abstract class IndexedElementsBinder extends AggregateBinder { private void bindValue(Bindable target, Collection collection, ResolvableType aggregateType, ResolvableType elementType, Object value) { - if (value instanceof String && !StringUtils.hasText((String) value)) { + if (value == null || value instanceof CharSequence && ((CharSequence) value).length() == 0) { return; } Object aggregate = convert(value, aggregateType, target.getAnnotations()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/CharSequenceToObjectConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/CharSequenceToObjectConverterTests.java index c36831909c..cc54977604 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/CharSequenceToObjectConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/CharSequenceToObjectConverterTests.java @@ -40,7 +40,6 @@ class CharSequenceToObjectConverterTests { @ConversionServiceTest void convertWhenCanConvertDirectlySkipsStringConversion(ConversionService conversionService) { assertThat(conversionService.convert(new String("1"), Long.class)).isEqualTo(1); - System.out.println(conversionService.getClass()); if (!ConversionServiceArguments.isApplicationConversionService(conversionService)) { assertThat(conversionService.convert(new StringBuilder("1"), Long.class)).isEqualTo(2); }