Commit 21f1b3a7 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #17847 from succezlijunyi

* pr/17847:
  Replace Collection#addAll to call constructor

Closes gh-17847
parents f8f3733e 200de49c
......@@ -38,8 +38,8 @@ final class HealthIndicatorRegistryBeans {
}
static HealthIndicatorRegistry get(ApplicationContext applicationContext) {
Map<String, HealthIndicator> indicators = new LinkedHashMap<>();
indicators.putAll(applicationContext.getBeansOfType(HealthIndicator.class));
Map<String, HealthIndicator> indicators = new LinkedHashMap<>(
applicationContext.getBeansOfType(HealthIndicator.class));
if (ClassUtils.isPresent("reactor.core.publisher.Flux", null)) {
new ReactiveHealthIndicators().get(applicationContext).forEach(indicators::putIfAbsent);
}
......
......@@ -74,8 +74,7 @@ class CompositeHandlerAdapter implements HandlerAdapter {
}
private List<HandlerAdapter> extractAdapters() {
List<HandlerAdapter> list = new ArrayList<>();
list.addAll(this.beanFactory.getBeansOfType(HandlerAdapter.class).values());
List<HandlerAdapter> list = new ArrayList<>(this.beanFactory.getBeansOfType(HandlerAdapter.class).values());
list.remove(this);
AnnotationAwareOrderComparator.sort(list);
return list;
......
......@@ -55,8 +55,8 @@ class CompositeHandlerExceptionResolver implements HandlerExceptionResolver {
}
private List<HandlerExceptionResolver> extractResolvers() {
List<HandlerExceptionResolver> list = new ArrayList<>();
list.addAll(this.beanFactory.getBeansOfType(HandlerExceptionResolver.class).values());
List<HandlerExceptionResolver> list = new ArrayList<>(
this.beanFactory.getBeansOfType(HandlerExceptionResolver.class).values());
list.remove(this);
AnnotationAwareOrderComparator.sort(list);
if (list.isEmpty()) {
......
......@@ -56,8 +56,7 @@ class CompositeHandlerMapping implements HandlerMapping {
}
private List<HandlerMapping> extractMappings() {
List<HandlerMapping> list = new ArrayList<>();
list.addAll(this.beanFactory.getBeansOfType(HandlerMapping.class).values());
List<HandlerMapping> list = new ArrayList<>(this.beanFactory.getBeansOfType(HandlerMapping.class).values());
list.remove(this);
AnnotationAwareOrderComparator.sort(list);
return list;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment