Replace Collection#addAll to call constructor

See gh-17847
pull/17864/head
lijuny 5 years ago committed by Stephane Nicoll
parent f8f3733e1c
commit 200de49c11

@ -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);
} }

@ -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;

@ -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()) {

@ -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;

Loading…
Cancel
Save