Commit c84a0f53 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #15798 from ayudovin

* pr/15798:
  Polish "Inject Map directly rather than via ObjectProvider"
  Inject Map directly rather than via ObjectProvider
parents 9d609ab1 ede23caa
......@@ -16,10 +16,8 @@
package org.springframework.boot.actuate.autoconfigure.cache;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
import org.springframework.boot.actuate.cache.CachesEndpoint;
import org.springframework.boot.actuate.cache.CachesEndpointWebExtension;
......@@ -48,9 +46,8 @@ public class CachesEndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public CachesEndpoint cachesEndpoint(
ObjectProvider<Map<String, CacheManager>> cacheManagers) {
return new CachesEndpoint(cacheManagers.getIfAvailable(LinkedHashMap::new));
public CachesEndpoint cachesEndpoint(Map<String, CacheManager> cacheManagers) {
return new CachesEndpoint(cacheManagers);
}
@Bean
......
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
......@@ -16,12 +16,10 @@
package org.springframework.boot.actuate.autoconfigure.health;
import java.util.Collections;
import java.util.Map;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.HealthIndicator;
......@@ -87,13 +85,11 @@ public class HealthIndicatorAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ReactiveHealthIndicatorRegistry reactiveHealthIndicatorRegistry(
ObjectProvider<Map<String, ReactiveHealthIndicator>> reactiveHealthIndicators,
ObjectProvider<Map<String, HealthIndicator>> healthIndicators) {
Map<String, ReactiveHealthIndicator> reactiveHealthIndicators,
Map<String, HealthIndicator> healthIndicators) {
return new ReactiveHealthIndicatorRegistryFactory()
.createReactiveHealthIndicatorRegistry(
reactiveHealthIndicators
.getIfAvailable(Collections::emptyMap),
healthIndicators.getIfAvailable(Collections::emptyMap));
.createReactiveHealthIndicatorRegistry(reactiveHealthIndicators,
healthIndicators);
}
}
......
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
......@@ -72,10 +72,9 @@ public class DataSourceHealthIndicatorAutoConfiguration extends
private DataSourcePoolMetadataProvider poolMetadataProvider;
public DataSourceHealthIndicatorAutoConfiguration(
ObjectProvider<Map<String, DataSource>> dataSources,
public DataSourceHealthIndicatorAutoConfiguration(Map<String, DataSource> dataSources,
ObjectProvider<DataSourcePoolMetadataProvider> metadataProviders) {
this.dataSources = filterDataSources(dataSources.getIfAvailable());
this.dataSources = filterDataSources(dataSources);
this.metadataProviders = metadataProviders.orderedStream()
.collect(Collectors.toList());
}
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
......@@ -20,7 +20,6 @@ import java.util.Map;
import javax.jms.ConnectionFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration;
......@@ -55,8 +54,8 @@ public class JmsHealthIndicatorAutoConfiguration extends
private final Map<String, ConnectionFactory> connectionFactories;
public JmsHealthIndicatorAutoConfiguration(
ObjectProvider<Map<String, ConnectionFactory>> connectionFactories) {
this.connectionFactories = connectionFactories.getIfAvailable();
Map<String, ConnectionFactory> connectionFactories) {
this.connectionFactories = connectionFactories;
}
@Bean
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
......@@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.mail;
import java.util.Map;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration;
......@@ -53,8 +52,8 @@ public class MailHealthIndicatorAutoConfiguration extends
private final Map<String, JavaMailSenderImpl> mailSenders;
public MailHealthIndicatorAutoConfiguration(
ObjectProvider<Map<String, JavaMailSenderImpl>> mailSenders) {
this.mailSenders = mailSenders.getIfAvailable();
Map<String, JavaMailSenderImpl> mailSenders) {
this.mailSenders = mailSenders;
}
@Bean
......
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
......@@ -74,13 +74,12 @@ public class QuartzAutoConfiguration {
public QuartzAutoConfiguration(QuartzProperties properties,
ObjectProvider<SchedulerFactoryBeanCustomizer> customizers,
ObjectProvider<JobDetail[]> jobDetails,
ObjectProvider<Map<String, Calendar>> calendars,
ObjectProvider<JobDetail[]> jobDetails, Map<String, Calendar> calendars,
ObjectProvider<Trigger[]> triggers, ApplicationContext applicationContext) {
this.properties = properties;
this.customizers = customizers;
this.jobDetails = jobDetails.getIfAvailable();
this.calendars = calendars.getIfAvailable();
this.calendars = calendars;
this.triggers = triggers.getIfAvailable();
this.applicationContext = applicationContext;
}
......
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