@ -29,6 +29,7 @@ import org.elasticsearch.client.Client;
import org.springframework.amqp.rabbit.core.RabbitTemplate ;
import org.springframework.beans.factory.InitializingBean ;
import org.springframework.beans.factory.ObjectProvider ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.boot.actuate.health.ApplicationHealthIndicator ;
import org.springframework.boot.actuate.health.CassandraHealthIndicator ;
@ -174,8 +175,12 @@ public class HealthIndicatorAutoConfiguration {
public static class CassandraHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration < CassandraHealthIndicator , CassandraOperations > {
@Autowired
private Map < String , CassandraOperations > cassandraOperations ;
private final Map < String , CassandraOperations > cassandraOperations ;
public CassandraHealthIndicatorConfiguration (
Map < String , CassandraOperations > cassandraOperations ) {
this . cassandraOperations = cassandraOperations ;
}
@Bean
@ConditionalOnMissingBean ( name = "cassandraHealthIndicator" )
@ -192,8 +197,12 @@ public class HealthIndicatorAutoConfiguration {
public static class CouchbaseHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration < CouchbaseHealthIndicator , CouchbaseOperations > {
@Autowired
private Map < String , CouchbaseOperations > couchbaseOperations ;
private final Map < String , CouchbaseOperations > couchbaseOperations ;
public CouchbaseHealthIndicatorConfiguration (
Map < String , CouchbaseOperations > couchbaseOperations ) {
this . couchbaseOperations = couchbaseOperations ;
}
@Bean
@ConditionalOnMissingBean ( name = "couchbaseHealthIndicator" )
@ -211,14 +220,19 @@ public class HealthIndicatorAutoConfiguration {
CompositeHealthIndicatorConfiguration < DataSourceHealthIndicator , DataSource >
implements InitializingBean {
@Autowired ( required = false )
private Map < String , DataSource > dataSources ;
private final Map < String , DataSource > dataSources ;
@Autowired ( required = false )
private Collection < DataSourcePoolMetadataProvider > metadataProviders ;
private final Collection < DataSourcePoolMetadataProvider > metadataProviders ;
private DataSourcePoolMetadataProvider poolMetadataProvider ;
public DataSourcesHealthIndicatorConfiguration (
ObjectProvider < Map < String , DataSource > > dataSourcesProvider ,
ObjectProvider < Collection < DataSourcePoolMetadataProvider > > metadataProvidersProvider ) {
this . dataSources = dataSourcesProvider . getIfAvailable ( ) ;
this . metadataProviders = metadataProvidersProvider . getIfAvailable ( ) ;
}
@Override
public void afterPropertiesSet ( ) throws Exception {
this . poolMetadataProvider = new DataSourcePoolMetadataProviders (
@ -250,8 +264,12 @@ public class HealthIndicatorAutoConfiguration {
public static class MongoHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration < MongoHealthIndicator , MongoTemplate > {
@Autowired
private Map < String , MongoTemplate > mongoTemplates ;
private final Map < String , MongoTemplate > mongoTemplates ;
public MongoHealthIndicatorConfiguration (
Map < String , MongoTemplate > mongoTemplates ) {
this . mongoTemplates = mongoTemplates ;
}
@Bean
@ConditionalOnMissingBean ( name = "mongoHealthIndicator" )
@ -267,8 +285,12 @@ public class HealthIndicatorAutoConfiguration {
public static class RedisHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration < RedisHealthIndicator , RedisConnectionFactory > {
@Autowired
private Map < String , RedisConnectionFactory > redisConnectionFactories ;
private final Map < String , RedisConnectionFactory > redisConnectionFactories ;
public RedisHealthIndicatorConfiguration (
Map < String , RedisConnectionFactory > redisConnectionFactories ) {
this . redisConnectionFactories = redisConnectionFactories ;
}
@Bean
@ConditionalOnMissingBean ( name = "redisHealthIndicator" )
@ -284,8 +306,12 @@ public class HealthIndicatorAutoConfiguration {
public static class RabbitHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration < RabbitHealthIndicator , RabbitTemplate > {
@Autowired
private Map < String , RabbitTemplate > rabbitTemplates ;
private final Map < String , RabbitTemplate > rabbitTemplates ;
public RabbitHealthIndicatorConfiguration (
Map < String , RabbitTemplate > rabbitTemplates ) {
this . rabbitTemplates = rabbitTemplates ;
}
@Bean
@ConditionalOnMissingBean ( name = "rabbitHealthIndicator" )
@ -301,8 +327,11 @@ public class HealthIndicatorAutoConfiguration {
public static class SolrHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration < SolrHealthIndicator , SolrClient > {
@Autowired
private Map < String , SolrClient > solrClients ;
private final Map < String , SolrClient > solrClients ;
public SolrHealthIndicatorConfiguration ( Map < String , SolrClient > solrClients ) {
this . solrClients = solrClients ;
}
@Bean
@ConditionalOnMissingBean ( name = "solrHealthIndicator" )
@ -336,8 +365,12 @@ public class HealthIndicatorAutoConfiguration {
public static class MailHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration < MailHealthIndicator , JavaMailSenderImpl > {
@Autowired ( required = false )
private Map < String , JavaMailSenderImpl > mailSenders ;
private final Map < String , JavaMailSenderImpl > mailSenders ;
public MailHealthIndicatorConfiguration (
ObjectProvider < Map < String , JavaMailSenderImpl > > mailSendersProvider ) {
this . mailSenders = mailSendersProvider . getIfAvailable ( ) ;
}
@Bean
@ConditionalOnMissingBean ( name = "mailHealthIndicator" )
@ -353,8 +386,12 @@ public class HealthIndicatorAutoConfiguration {
public static class JmsHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration < JmsHealthIndicator , ConnectionFactory > {
@Autowired ( required = false )
private Map < String , ConnectionFactory > connectionFactories ;
private final Map < String , ConnectionFactory > connectionFactories ;
public JmsHealthIndicatorConfiguration (
ObjectProvider < Map < String , ConnectionFactory > > connectionFactoriesProvider ) {
this . connectionFactories = connectionFactoriesProvider . getIfAvailable ( ) ;
}
@Bean
@ConditionalOnMissingBean ( name = "jmsHealthIndicator" )
@ -371,11 +408,15 @@ public class HealthIndicatorAutoConfiguration {
public static class ElasticsearchHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration < ElasticsearchHealthIndicator , Client > {
@Autowired
private Map < String , Client > clients ;
private final Map < String , Client > clients ;
@Autowired
private ElasticsearchHealthIndicatorProperties properties ;
private final ElasticsearchHealthIndicatorProperties properties ;
public ElasticsearchHealthIndicatorConfiguration ( Map < String , Client > clients ,
ElasticsearchHealthIndicatorProperties properties ) {
this . clients = clients ;
this . properties = properties ;
}
@Bean
@ConditionalOnMissingBean ( name = "elasticsearchHealthIndicator" )