Polish
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
public @interface ConfigurationPropertiesBinding {
|
||||
|
||||
/**
|
||||
* Concrete value for the <code>@Qualifier</code>.
|
||||
* Concrete value for the {@link Qualifier @Qualifier}.
|
||||
*/
|
||||
String VALUE = "org.springframework.boot.context.properties.ConfigurationPropertiesBinding";
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.context.properties;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
@@ -70,16 +71,18 @@ class ConversionServiceDeducer {
|
||||
ConfigurationPropertiesBinding.VALUE);
|
||||
}
|
||||
|
||||
private static <T> List<T> beans(BeanFactory beanFactory, Class<T> type,
|
||||
private <T> List<T> beans(BeanFactory beanFactory, Class<T> type,
|
||||
String qualifier) {
|
||||
List<T> list = new ArrayList<>();
|
||||
if (!(beanFactory instanceof ListableBeanFactory)) {
|
||||
return list;
|
||||
if (beanFactory instanceof ListableBeanFactory) {
|
||||
return beans(type, qualifier, (ListableBeanFactory) beanFactory);
|
||||
}
|
||||
ListableBeanFactory listable = (ListableBeanFactory) beanFactory;
|
||||
list.addAll(BeanFactoryAnnotationUtils
|
||||
.qualifiedBeansOfType(listable, type, qualifier).values());
|
||||
return list;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private <T> List<T> beans(Class<T> type, String qualifier,
|
||||
ListableBeanFactory beanFactory) {
|
||||
return new ArrayList<T>(BeanFactoryAnnotationUtils
|
||||
.qualifiedBeansOfType(beanFactory, type, qualifier).values());
|
||||
}
|
||||
|
||||
public ConversionService create() {
|
||||
|
||||
Reference in New Issue
Block a user