Replace Collection#addAll to call constructor

See gh-17847
This commit is contained in:
lijuny 2019-08-13 07:49:33 +08:00 committed by Stephane Nicoll
parent f8f3733e1c
commit 200de49c11
4 changed files with 6 additions and 8 deletions

View File

@ -38,8 +38,8 @@ final class HealthIndicatorRegistryBeans {
} }
static HealthIndicatorRegistry get(ApplicationContext applicationContext) { static HealthIndicatorRegistry get(ApplicationContext applicationContext) {
Map<String, HealthIndicator> indicators = new LinkedHashMap<>(); Map<String, HealthIndicator> indicators = new LinkedHashMap<>(
indicators.putAll(applicationContext.getBeansOfType(HealthIndicator.class)); applicationContext.getBeansOfType(HealthIndicator.class));
if (ClassUtils.isPresent("reactor.core.publisher.Flux", null)) { if (ClassUtils.isPresent("reactor.core.publisher.Flux", null)) {
new ReactiveHealthIndicators().get(applicationContext).forEach(indicators::putIfAbsent); new ReactiveHealthIndicators().get(applicationContext).forEach(indicators::putIfAbsent);
} }

View File

@ -74,8 +74,7 @@ class CompositeHandlerAdapter implements HandlerAdapter {
} }
private List<HandlerAdapter> extractAdapters() { private List<HandlerAdapter> extractAdapters() {
List<HandlerAdapter> list = new ArrayList<>(); List<HandlerAdapter> list = new ArrayList<>(this.beanFactory.getBeansOfType(HandlerAdapter.class).values());
list.addAll(this.beanFactory.getBeansOfType(HandlerAdapter.class).values());
list.remove(this); list.remove(this);
AnnotationAwareOrderComparator.sort(list); AnnotationAwareOrderComparator.sort(list);
return list; return list;

View File

@ -55,8 +55,8 @@ class CompositeHandlerExceptionResolver implements HandlerExceptionResolver {
} }
private List<HandlerExceptionResolver> extractResolvers() { private List<HandlerExceptionResolver> extractResolvers() {
List<HandlerExceptionResolver> list = new ArrayList<>(); List<HandlerExceptionResolver> list = new ArrayList<>(
list.addAll(this.beanFactory.getBeansOfType(HandlerExceptionResolver.class).values()); this.beanFactory.getBeansOfType(HandlerExceptionResolver.class).values());
list.remove(this); list.remove(this);
AnnotationAwareOrderComparator.sort(list); AnnotationAwareOrderComparator.sort(list);
if (list.isEmpty()) { if (list.isEmpty()) {

View File

@ -56,8 +56,7 @@ class CompositeHandlerMapping implements HandlerMapping {
} }
private List<HandlerMapping> extractMappings() { private List<HandlerMapping> extractMappings() {
List<HandlerMapping> list = new ArrayList<>(); List<HandlerMapping> list = new ArrayList<>(this.beanFactory.getBeansOfType(HandlerMapping.class).values());
list.addAll(this.beanFactory.getBeansOfType(HandlerMapping.class).values());
list.remove(this); list.remove(this);
AnnotationAwareOrderComparator.sort(list); AnnotationAwareOrderComparator.sort(list);
return list; return list;