@ -18,6 +18,7 @@ package org.springframework.boot.context.properties.bind;
import java.lang.annotation.Annotation ;
import java.lang.annotation.Annotation ;
import java.util.Collection ;
import java.util.Collection ;
import java.util.Collections ;
import java.util.List ;
import java.util.List ;
import java.util.TreeSet ;
import java.util.TreeSet ;
import java.util.function.Supplier ;
import java.util.function.Supplier ;
@ -32,6 +33,7 @@ import org.springframework.boot.context.properties.source.IterableConfigurationP
import org.springframework.core.ResolvableType ;
import org.springframework.core.ResolvableType ;
import org.springframework.util.LinkedMultiValueMap ;
import org.springframework.util.LinkedMultiValueMap ;
import org.springframework.util.MultiValueMap ;
import org.springframework.util.MultiValueMap ;
import org.springframework.util.StringUtils ;
/ * *
/ * *
* Base class for { @link AggregateBinder AggregateBinders } that read a sequential run of
* Base class for { @link AggregateBinder AggregateBinders } that read a sequential run of
@ -81,11 +83,17 @@ abstract class IndexedElementsBinder<T> extends AggregateBinder<T> {
ResolvableType aggregateType , ResolvableType elementType ) {
ResolvableType aggregateType , ResolvableType elementType ) {
ConfigurationProperty property = source . getConfigurationProperty ( root ) ;
ConfigurationProperty property = source . getConfigurationProperty ( root ) ;
if ( property ! = null ) {
if ( property ! = null ) {
Object aggregate = convert ( property . getValue ( ) , aggregateType ,
Collection < Object > elements ;
target . getAnnotations ( ) ) ;
Object value = property . getValue ( ) ;
ResolvableType collectionType = ResolvableType
if ( value instanceof String & & ! StringUtils . hasText ( ( String ) value ) ) {
. forClassWithGenerics ( collection . get ( ) . getClass ( ) , elementType ) ;
elements = Collections . emptyList ( ) ;
Collection < Object > elements = convert ( aggregate , collectionType ) ;
}
else {
Object aggregate = convert ( value , aggregateType , target . getAnnotations ( ) ) ;
ResolvableType collectionType = ResolvableType
. forClassWithGenerics ( collection . get ( ) . getClass ( ) , elementType ) ;
elements = convert ( aggregate , collectionType ) ;
}
collection . get ( ) . addAll ( elements ) ;
collection . get ( ) . addAll ( elements ) ;
}
}
else {
else {