|
18 | 18 |
|
19 | 19 | import java.lang.annotation.Annotation;
|
20 | 20 | import java.util.Collection;
|
| 21 | +import java.util.Collections; |
21 | 22 | import java.util.List;
|
22 | 23 | import java.util.TreeSet;
|
23 | 24 | import java.util.function.Supplier;
|
|
32 | 33 | import org.springframework.core.ResolvableType;
|
33 | 34 | import org.springframework.util.LinkedMultiValueMap;
|
34 | 35 | import org.springframework.util.MultiValueMap;
|
| 36 | +import org.springframework.util.StringUtils; |
35 | 37 |
|
36 | 38 | /**
|
37 | 39 | * Base class for {@link AggregateBinder AggregateBinders} that read a sequential run of
|
@@ -81,11 +83,17 @@ private void bindIndexed(ConfigurationPropertySource source,
|
81 | 83 | ResolvableType aggregateType, ResolvableType elementType) {
|
82 | 84 | ConfigurationProperty property = source.getConfigurationProperty(root);
|
83 | 85 | if (property != null) {
|
84 |
| - Object aggregate = convert(property.getValue(), aggregateType, |
85 |
| - target.getAnnotations()); |
86 |
| - ResolvableType collectionType = ResolvableType |
87 |
| - .forClassWithGenerics(collection.get().getClass(), elementType); |
88 |
| - Collection<Object> elements = convert(aggregate, collectionType); |
| 86 | + Collection<Object> elements; |
| 87 | + Object value = property.getValue(); |
| 88 | + if (value instanceof String && !StringUtils.hasText((String) value)) { |
| 89 | + elements = Collections.emptyList(); |
| 90 | + } |
| 91 | + else { |
| 92 | + Object aggregate = convert(value, aggregateType, target.getAnnotations()); |
| 93 | + ResolvableType collectionType = ResolvableType |
| 94 | + .forClassWithGenerics(collection.get().getClass(), elementType); |
| 95 | + elements = convert(aggregate, collectionType); |
| 96 | + } |
89 | 97 | collection.get().addAll(elements);
|
90 | 98 | }
|
91 | 99 | else {
|
|
0 commit comments