Configure ping (formerly application) health indicator by default
This commit renames ApplicationHealthIndicator to PingHealthIndicator and changes the auto-configuration so that it is now always configured by default. Closes gh-17926
This commit is contained in:
@@ -22,10 +22,8 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.boot.actuate.amqp.RabbitHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
@@ -44,7 +42,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(RabbitTemplate.class)
|
||||
@ConditionalOnBean(RabbitTemplate.class)
|
||||
@ConditionalOnEnabledHealthIndicator("rabbit")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(RabbitAutoConfiguration.class)
|
||||
public class RabbitHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<RabbitHealthIndicator, RabbitTemplate> {
|
||||
|
||||
@@ -22,11 +22,9 @@ import com.datastax.driver.core.Cluster;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.cassandra.CassandraHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
@@ -49,7 +47,6 @@ import org.springframework.data.cassandra.core.CassandraOperations;
|
||||
@ConditionalOnClass({ Cluster.class, CassandraOperations.class })
|
||||
@ConditionalOnBean(CassandraOperations.class)
|
||||
@ConditionalOnEnabledHealthIndicator("cassandra")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter({ CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class })
|
||||
public class CassandraHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<CassandraHealthIndicator, CassandraOperations> {
|
||||
|
||||
@@ -22,11 +22,9 @@ import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.cassandra.CassandraReactiveHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -48,7 +46,6 @@ import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
|
||||
@ConditionalOnClass({ Cluster.class, ReactiveCassandraOperations.class, Flux.class })
|
||||
@ConditionalOnBean(ReactiveCassandraOperations.class)
|
||||
@ConditionalOnEnabledHealthIndicator("cassandra")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(CassandraReactiveDataAutoConfiguration.class)
|
||||
public class CassandraReactiveHealthContributorAutoConfiguration extends
|
||||
CompositeReactiveHealthContributorConfiguration<CassandraReactiveHealthIndicator, ReactiveCassandraOperations> {
|
||||
|
||||
@@ -21,11 +21,9 @@ import com.couchbase.client.java.Cluster;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.couchbase.CouchbaseHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -47,7 +45,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(Cluster.class)
|
||||
@ConditionalOnBean(Cluster.class)
|
||||
@ConditionalOnEnabledHealthIndicator("couchbase")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter({ CouchbaseAutoConfiguration.class })
|
||||
public class CouchbaseHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<CouchbaseHealthIndicator, Cluster> {
|
||||
|
||||
@@ -22,11 +22,9 @@ import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.couchbase.CouchbaseReactiveHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -47,7 +45,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass({ Cluster.class, Flux.class })
|
||||
@ConditionalOnBean(Cluster.class)
|
||||
@ConditionalOnEnabledHealthIndicator("couchbase")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(CouchbaseAutoConfiguration.class)
|
||||
public class CouchbaseReactiveHealthContributorAutoConfiguration
|
||||
extends CompositeReactiveHealthContributorConfiguration<CouchbaseReactiveHealthIndicator, Cluster> {
|
||||
|
||||
@@ -23,11 +23,9 @@ import org.elasticsearch.client.Client;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.elasticsearch.ElasticsearchHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -50,7 +48,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(Client.class)
|
||||
@ConditionalOnBean(Client.class)
|
||||
@ConditionalOnEnabledHealthIndicator("elasticsearch")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(ElasticsearchAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(ElasticsearchHealthIndicatorProperties.class)
|
||||
@Deprecated
|
||||
|
||||
@@ -22,12 +22,10 @@ import io.searchbox.client.JestClient;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.elasticsearch.ElasticsearchHealthIndicator;
|
||||
import org.springframework.boot.actuate.elasticsearch.ElasticsearchJestHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -47,7 +45,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(JestClient.class)
|
||||
@ConditionalOnBean(JestClient.class)
|
||||
@ConditionalOnEnabledHealthIndicator("elasticsearch")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter({ JestAutoConfiguration.class, ElasticSearchClientHealthContributorAutoConfiguration.class })
|
||||
@Deprecated
|
||||
public class ElasticSearchJestHealthContributorAutoConfiguration
|
||||
|
||||
@@ -22,11 +22,9 @@ import org.elasticsearch.client.RestClient;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.elasticsearch.ElasticsearchRestHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -46,7 +44,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(RestClient.class)
|
||||
@ConditionalOnBean(RestClient.class)
|
||||
@ConditionalOnEnabledHealthIndicator("elasticsearch")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter({ RestClientAutoConfiguration.class, ElasticSearchClientHealthContributorAutoConfiguration.class })
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ElasticSearchRestHealthContributorAutoConfiguration
|
||||
|
||||
@@ -22,11 +22,9 @@ import com.hazelcast.core.HazelcastInstance;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.hazelcast.HazelcastHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -46,7 +44,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(HazelcastInstance.class)
|
||||
@ConditionalOnBean(HazelcastInstance.class)
|
||||
@ConditionalOnEnabledHealthIndicator("hazelcast")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(HazelcastAutoConfiguration.class)
|
||||
public class HazelcastHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<HazelcastHealthIndicator, HazelcastInstance> {
|
||||
|
||||
@@ -16,18 +16,15 @@
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.health;
|
||||
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributor;
|
||||
import org.springframework.boot.actuate.health.PingHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link HealthContributor health
|
||||
* contributors}. Technology specific auto-configurations should be ordered before this
|
||||
* auto-configuration.
|
||||
* contributors}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 2.2.0
|
||||
@@ -36,9 +33,9 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class HealthContributorAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({ HealthContributor.class, ReactiveHealthContributor.class })
|
||||
public ApplicationHealthIndicator applicationHealthContributor() {
|
||||
return new ApplicationHealthIndicator();
|
||||
@ConditionalOnEnabledHealthIndicator("ping")
|
||||
public PingHealthIndicator pingHealthContributor() {
|
||||
return new PingHealthIndicator();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.health;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||
import org.springframework.boot.actuate.health.HealthEndpoint;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -34,7 +33,6 @@ import org.springframework.context.annotation.Import;
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties(HealthEndpointProperties.class)
|
||||
@AutoConfigureAfter(HealthContributorAutoConfiguration.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = HealthEndpoint.class)
|
||||
@Import({ LegacyHealthEndpointAdaptersConfiguration.class, LegacyHealthEndpointCompatibiltyConfiguration.class,
|
||||
HealthEndpointConfiguration.class, ReactiveHealthEndpointConfiguration.class,
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.boot.actuate.autoconfigure.health;
|
||||
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -34,7 +33,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
public class HealthIndicatorAutoConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -22,11 +22,9 @@ import org.influxdb.InfluxDB;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.influx.InfluxDbHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -45,7 +43,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(InfluxDB.class)
|
||||
@ConditionalOnBean(InfluxDB.class)
|
||||
@ConditionalOnEnabledHealthIndicator("influxdb")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(InfluxDbAutoConfiguration.class)
|
||||
public class InfluxDbHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<InfluxDbHealthIndicator, InfluxDB> {
|
||||
|
||||
@@ -27,11 +27,9 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -60,7 +58,6 @@ import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||
@ConditionalOnClass({ JdbcTemplate.class, AbstractRoutingDataSource.class })
|
||||
@ConditionalOnBean(DataSource.class)
|
||||
@ConditionalOnEnabledHealthIndicator("db")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
|
||||
public class DataSourceHealthContributorAutoConfiguration extends
|
||||
CompositeHealthContributorConfiguration<DataSourceHealthIndicator, DataSource> implements InitializingBean {
|
||||
|
||||
@@ -22,11 +22,9 @@ import javax.jms.ConnectionFactory;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.jms.JmsHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -46,7 +44,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(ConnectionFactory.class)
|
||||
@ConditionalOnBean(ConnectionFactory.class)
|
||||
@ConditionalOnEnabledHealthIndicator("jms")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter({ ActiveMQAutoConfiguration.class, ArtemisAutoConfiguration.class })
|
||||
public class JmsHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<JmsHealthIndicator, ConnectionFactory> {
|
||||
|
||||
@@ -20,11 +20,9 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.ldap.LdapHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -45,7 +43,6 @@ import org.springframework.ldap.core.LdapOperations;
|
||||
@ConditionalOnClass(LdapOperations.class)
|
||||
@ConditionalOnBean(LdapOperations.class)
|
||||
@ConditionalOnEnabledHealthIndicator("ldap")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(LdapAutoConfiguration.class)
|
||||
public class LdapHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<LdapHealthIndicator, LdapOperations> {
|
||||
|
||||
@@ -20,11 +20,9 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.mail.MailHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -44,7 +42,6 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
@ConditionalOnClass(JavaMailSenderImpl.class)
|
||||
@ConditionalOnBean(JavaMailSenderImpl.class)
|
||||
@ConditionalOnEnabledHealthIndicator("mail")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(MailSenderAutoConfiguration.class)
|
||||
public class MailHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<MailHealthIndicator, JavaMailSenderImpl> {
|
||||
|
||||
@@ -20,11 +20,9 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.mongo.MongoHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -45,7 +43,6 @@ import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
@ConditionalOnClass(MongoTemplate.class)
|
||||
@ConditionalOnBean(MongoTemplate.class)
|
||||
@ConditionalOnEnabledHealthIndicator("mongo")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter({ MongoAutoConfiguration.class, MongoDataAutoConfiguration.class })
|
||||
public class MongoHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<MongoHealthIndicator, MongoTemplate> {
|
||||
|
||||
@@ -22,11 +22,9 @@ import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributor;
|
||||
import org.springframework.boot.actuate.mongo.MongoReactiveHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -47,7 +45,6 @@ import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
|
||||
@ConditionalOnClass({ ReactiveMongoTemplate.class, Flux.class })
|
||||
@ConditionalOnBean(ReactiveMongoTemplate.class)
|
||||
@ConditionalOnEnabledHealthIndicator("mongo")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(MongoReactiveDataAutoConfiguration.class)
|
||||
public class MongoReactiveHealthContributorAutoConfiguration
|
||||
extends CompositeReactiveHealthContributorConfiguration<MongoReactiveHealthIndicator, ReactiveMongoTemplate> {
|
||||
|
||||
@@ -22,11 +22,9 @@ import org.neo4j.ogm.session.SessionFactory;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.neo4j.Neo4jHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -46,7 +44,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(SessionFactory.class)
|
||||
@ConditionalOnBean(SessionFactory.class)
|
||||
@ConditionalOnEnabledHealthIndicator("neo4j")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(Neo4jDataAutoConfiguration.class)
|
||||
public class Neo4jHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<Neo4jHealthIndicator, SessionFactory> {
|
||||
|
||||
@@ -20,11 +20,9 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.redis.RedisHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -47,7 +45,6 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
@ConditionalOnClass(RedisConnectionFactory.class)
|
||||
@ConditionalOnBean(RedisConnectionFactory.class)
|
||||
@ConditionalOnEnabledHealthIndicator("redis")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(RedisAutoConfiguration.class)
|
||||
public class RedisHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<RedisHealthIndicator, RedisConnectionFactory> {
|
||||
|
||||
@@ -22,11 +22,9 @@ import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributor;
|
||||
import org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -50,7 +48,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
|
||||
@ConditionalOnClass({ ReactiveRedisConnectionFactory.class, Flux.class })
|
||||
@ConditionalOnBean(ReactiveRedisConnectionFactory.class)
|
||||
@ConditionalOnEnabledHealthIndicator("redis")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(RedisReactiveAutoConfiguration.class)
|
||||
public class RedisReactiveHealthContributorAutoConfiguration extends
|
||||
CompositeReactiveHealthContributorConfiguration<RedisReactiveHealthIndicator, ReactiveRedisConnectionFactory> {
|
||||
|
||||
@@ -22,11 +22,9 @@ import org.apache.solr.client.solrj.SolrClient;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.solr.SolrHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -46,7 +44,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnClass(SolrClient.class)
|
||||
@ConditionalOnBean(SolrClient.class)
|
||||
@ConditionalOnEnabledHealthIndicator("solr")
|
||||
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
|
||||
@AutoConfigureAfter(SolrAutoConfiguration.class)
|
||||
public class SolrHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<SolrHealthIndicator, SolrClient> {
|
||||
|
||||
@@ -131,6 +131,12 @@
|
||||
"description": "Whether to enable MongoDB health check.",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "management.health.ping.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Whether to enable ping health check.",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "management.health.rabbit.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.amqp.RabbitHealthIndicator;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@@ -40,15 +39,13 @@ class RabbitHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(RabbitHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(RabbitHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.rabbit.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(RabbitHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(RabbitHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.cassandra.CassandraHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@@ -44,15 +43,13 @@ class CassandraHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(CassandraHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(CassandraHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.cassandra.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(CassandraHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(CassandraHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.cassandra.CassandraHealthIndicator;
|
||||
import org.springframework.boot.actuate.cassandra.CassandraReactiveHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
|
||||
@@ -45,14 +44,13 @@ class CassandraReactiveHealthContributorAutoConfigurationTests {
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(CassandraReactiveHealthIndicator.class)
|
||||
.doesNotHaveBean(CassandraHealthIndicator.class).doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(CassandraHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.cassandra.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(CassandraReactiveHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(CassandraReactiveHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.couchbase.CouchbaseHealthIndicator;
|
||||
import org.springframework.boot.actuate.couchbase.CouchbaseReactiveHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
@@ -43,15 +42,13 @@ class CouchbaseHealthContributorAutoConfigurationTests {
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(CouchbaseHealthIndicator.class)
|
||||
.doesNotHaveBean(CouchbaseReactiveHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(CouchbaseReactiveHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.couchbase.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(CouchbaseHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(CouchbaseHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.couchbase.CouchbaseHealthIndicator;
|
||||
import org.springframework.boot.actuate.couchbase.CouchbaseReactiveHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
@@ -44,14 +43,13 @@ class CouchbaseReactiveHealthContributorAutoConfigurationTests {
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(CouchbaseReactiveHealthIndicator.class)
|
||||
.doesNotHaveBean(CouchbaseHealthIndicator.class).doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(CouchbaseHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.couchbase.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(CouchbaseReactiveHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(CouchbaseReactiveHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.elasticsearch.ElasticsearchHealthIndicator;
|
||||
import org.springframework.boot.actuate.elasticsearch.ElasticsearchJestHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@@ -49,8 +48,7 @@ class ElasticsearchHealthContributorAutoConfigurationTests {
|
||||
this.contextRunner.withPropertyValues("spring.data.elasticsearch.cluster-nodes:localhost:0")
|
||||
.withSystemProperties("es.set.netty.runtime.available.processors=false")
|
||||
.run((context) -> assertThat(context).hasSingleBean(ElasticsearchHealthIndicator.class)
|
||||
.doesNotHaveBean(ElasticsearchJestHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(ElasticsearchJestHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -58,16 +56,14 @@ class ElasticsearchHealthContributorAutoConfigurationTests {
|
||||
this.contextRunner.withBean(JestClient.class, () -> mock(JestClient.class))
|
||||
.withSystemProperties("es.set.netty.runtime.available.processors=false")
|
||||
.run((context) -> assertThat(context).hasSingleBean(ElasticsearchJestHealthIndicator.class)
|
||||
.doesNotHaveBean(ElasticsearchHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(ElasticsearchHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.elasticsearch.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(ElasticsearchHealthIndicator.class)
|
||||
.doesNotHaveBean(ElasticsearchJestHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(ElasticsearchJestHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.hazelcast.HazelcastHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@@ -40,15 +39,13 @@ class HazelcastHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(HazelcastHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(HazelcastHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.hazelcast.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(HazelcastHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(HazelcastHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ package org.springframework.boot.actuate.autoconfigure.health;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||
import org.springframework.boot.actuate.health.PingHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -40,32 +40,31 @@ class HealthContributorAutoConfigurationTests {
|
||||
.withConfiguration(AutoConfigurations.of(HealthContributorAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
void runWhenNoOtherIndicatorsCreatesDefaultApplicationHealthIndicator() {
|
||||
void runWhenNoOtherIndicatorsCreatesPingHealthIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).getBean(HealthIndicator.class)
|
||||
.isInstanceOf(ApplicationHealthIndicator.class));
|
||||
.isInstanceOf(PingHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenHasDefinedIndicatorDoesNotCreateDefaultApplicationHealthIndicator() {
|
||||
void runWhenHasDefinedIndicatorCreatesPingHealthIndicator() {
|
||||
this.contextRunner.withUserConfiguration(CustomHealthIndicatorConfiguration.class)
|
||||
.run((context) -> assertThat(context).getBean(HealthIndicator.class)
|
||||
.isInstanceOf(CustomHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).hasSingleBean(PingHealthIndicator.class)
|
||||
.hasSingleBean(CustomHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenHasDefaultsDisabledAndNoSingleIndicatorEnabledCreatesDefaultApplicationHealthIndicator() {
|
||||
void runWhenHasDefaultsDisabledDoesNotCreatePingHealthIndicator() {
|
||||
this.contextRunner.withUserConfiguration(CustomHealthIndicatorConfiguration.class)
|
||||
.withPropertyValues("management.health.defaults.enabled:false").run((context) -> assertThat(context)
|
||||
.getBean(HealthIndicator.class).isInstanceOf(ApplicationHealthIndicator.class));
|
||||
.withPropertyValues("management.health.defaults.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(HealthIndicator.class));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenHasDefaultsDisabledAndSingleIndicatorEnabledDoesNotCreateEnabledIndicator() {
|
||||
void runWhenHasDefaultsDisabledAndPingIndicatorEnabledCreatesPingHealthIndicator() {
|
||||
this.contextRunner.withUserConfiguration(CustomHealthIndicatorConfiguration.class)
|
||||
.withPropertyValues("management.health.defaults.enabled:false", "management.health.custom.enabled:true")
|
||||
.run((context) -> assertThat(context).getBean(HealthIndicator.class)
|
||||
.isInstanceOf(CustomHealthIndicator.class));
|
||||
.withPropertyValues("management.health.defaults.enabled:false", "management.health.ping.enabled:true")
|
||||
.run((context) -> assertThat(context).hasSingleBean(PingHealthIndicator.class));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ class HealthEndpointAutoConfigurationTests {
|
||||
this.contextRunner.run((context) -> {
|
||||
HealthContributorRegistry registry = context.getBean(HealthContributorRegistry.class);
|
||||
Object[] names = registry.stream().map(NamedContributor::getName).toArray();
|
||||
assertThat(names).containsExactlyInAnyOrder("simple", "additional");
|
||||
assertThat(names).containsExactlyInAnyOrder("simple", "additional", "ping");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ class HealthEndpointAutoConfigurationTests {
|
||||
this.reactiveContextRunner.run((context) -> {
|
||||
ReactiveHealthContributorRegistry registry = context.getBean(ReactiveHealthContributorRegistry.class);
|
||||
Object[] names = registry.stream().map(NamedContributor::getName).toArray();
|
||||
assertThat(names).containsExactlyInAnyOrder("simple", "additional", "reactive");
|
||||
assertThat(names).containsExactlyInAnyOrder("simple", "additional", "reactive", "ping");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.influxdb.InfluxDB;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.influx.InfluxDbHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@@ -41,15 +40,13 @@ class InfluxDbHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(InfluxDbHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(InfluxDbHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.influxdb.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(InfluxDbHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(InfluxDbHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@ import javax.sql.DataSource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.CompositeHealthContributor;
|
||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||
import org.springframework.boot.actuate.health.NamedContributor;
|
||||
import org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
@@ -57,8 +55,7 @@ class DataSourceHealthContributorAutoConfigurationTests {
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> {
|
||||
context.getBean(DataSourceHealthIndicator.class);
|
||||
assertThat(context).hasSingleBean(DataSourceHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class);
|
||||
assertThat(context).hasSingleBean(DataSourceHealthIndicator.class);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,7 +82,7 @@ class DataSourceHealthContributorAutoConfigurationTests {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(DataSourceConfig.class, DataSourcePoolMetadataProvidersConfiguration.class)
|
||||
.withPropertyValues("spring.datasource.test.validation-query:SELECT from FOOBAR").run((context) -> {
|
||||
assertThat(context).hasSingleBean(HealthIndicator.class);
|
||||
assertThat(context).hasSingleBean(DataSourceHealthIndicator.class);
|
||||
DataSourceHealthIndicator indicator = context.getBean(DataSourceHealthIndicator.class);
|
||||
assertThat(indicator.getQuery()).isEqualTo("SELECT from FOOBAR");
|
||||
});
|
||||
@@ -96,8 +93,7 @@ class DataSourceHealthContributorAutoConfigurationTests {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("management.health.db.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(DataSourceHealthIndicator.class)
|
||||
.doesNotHaveBean(CompositeHealthContributor.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(CompositeHealthContributor.class));
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.jms;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.jms.JmsHealthIndicator;
|
||||
import org.springframework.boot.actuate.ldap.LdapHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
@@ -41,15 +40,13 @@ class JmsHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(JmsHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(JmsHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.jms.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(LdapHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(LdapHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.ldap;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.ldap.LdapHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@@ -42,15 +41,13 @@ class LdapHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(LdapHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(LdapHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.ldap.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(LdapHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(LdapHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.mail;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.mail.MailHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration;
|
||||
@@ -41,15 +40,13 @@ class MailHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(MailHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(MailHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.mail.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(MailHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(MailHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.mongo;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.mongo.MongoHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
|
||||
@@ -41,15 +40,13 @@ class MongoHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(MongoHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(MongoHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.mongo.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(MongoHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(MongoHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.mongo;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.mongo.MongoHealthIndicator;
|
||||
import org.springframework.boot.actuate.mongo.MongoReactiveHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
@@ -46,14 +45,14 @@ class MongoReactiveHealthContributorAutoConfigurationTests {
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(MongoReactiveHealthIndicator.class)
|
||||
.doesNotHaveBean(MongoHealthIndicator.class).doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(MongoHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.mongo.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(MongoReactiveHealthIndicator.class)
|
||||
.doesNotHaveBean(MongoHealthIndicator.class).hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(MongoHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.neo4j.ogm.session.Session;
|
||||
import org.neo4j.ogm.session.SessionFactory;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
import org.springframework.boot.actuate.neo4j.Neo4jHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
@@ -47,22 +46,19 @@ class Neo4jHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(Neo4jHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(Neo4jHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.neo4j.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(Neo4jHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(Neo4jHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void defaultIndicatorCanBeReplaced() {
|
||||
this.contextRunner.withUserConfiguration(CustomIndicatorConfiguration.class).run((context) -> {
|
||||
assertThat(context).hasSingleBean(Neo4jHealthIndicator.class);
|
||||
assertThat(context).doesNotHaveBean(ApplicationHealthIndicator.class);
|
||||
Health health = context.getBean(Neo4jHealthIndicator.class).health();
|
||||
assertThat(health.getDetails()).containsOnly(entry("test", true));
|
||||
});
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.redis;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.redis.RedisHealthIndicator;
|
||||
import org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
@@ -44,15 +43,14 @@ class RedisHealthContributorAutoConfigurationTests {
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(RedisHealthIndicator.class)
|
||||
.doesNotHaveBean(RedisReactiveHealthIndicator.class).doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(RedisReactiveHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.redis.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(RedisHealthIndicator.class)
|
||||
.doesNotHaveBean(RedisReactiveHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(RedisReactiveHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.redis;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.redis.RedisHealthIndicator;
|
||||
import org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
@@ -43,14 +42,14 @@ class RedisReactiveHealthContributorAutoConfigurationTests {
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run(
|
||||
(context) -> assertThat(context).hasSingleBean(RedisReactiveHealthContributorAutoConfiguration.class)
|
||||
.doesNotHaveBean(RedisHealthIndicator.class).doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(RedisHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.redis.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(RedisReactiveHealthIndicator.class)
|
||||
.doesNotHaveBean(RedisHealthIndicator.class).hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.doesNotHaveBean(RedisHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.solr;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.solr.SolrHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration;
|
||||
@@ -40,15 +39,13 @@ class SolrHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(SolrHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(SolrHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.solr.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(SolrHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(SolrHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.system;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.actuate.system.DiskSpaceHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@@ -40,8 +39,7 @@ class DiskSpaceHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runShouldCreateIndicator() {
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(DiskSpaceHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(DiskSpaceHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,8 +61,7 @@ class DiskSpaceHealthContributorAutoConfigurationTests {
|
||||
@Test
|
||||
void runWhenDisabledShouldNotCreateIndicator() {
|
||||
this.contextRunner.withPropertyValues("management.health.diskspace.enabled:false")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(DiskSpaceHealthIndicator.class)
|
||||
.hasSingleBean(ApplicationHealthIndicator.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(DiskSpaceHealthIndicator.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ package org.springframework.boot.actuate.health;
|
||||
* @author Christian Dupuis
|
||||
* @since 1.2.0
|
||||
* @see Status#UP
|
||||
* @deprecated since 2.2 in favor of {@link PingHealthIndicator}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class ApplicationHealthIndicator extends AbstractHealthIndicator {
|
||||
|
||||
public ApplicationHealthIndicator() {
|
||||
|
||||
@@ -23,7 +23,6 @@ package org.springframework.boot.actuate.health;
|
||||
* @author Dave Syer
|
||||
* @author Phillip Webb
|
||||
* @since 1.0.0
|
||||
* @see ApplicationHealthIndicator
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface HealthIndicator extends HealthContributor {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.health;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link HealthIndicator} that returns {@link Status#UP}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Christian Dupuis
|
||||
* @since 2.2.0
|
||||
* @see Status#UP
|
||||
*/
|
||||
public class PingHealthIndicator extends AbstractHealthIndicator {
|
||||
|
||||
@Override
|
||||
protected void doHealthCheck(Health.Builder builder) throws Exception {
|
||||
builder.up();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
@Deprecated
|
||||
class ApplicationHealthIndicatorTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.health;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link PingHealthIndicator}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
class PingHealthIndicatorTests {
|
||||
|
||||
@Test
|
||||
void indicatesUp() {
|
||||
PingHealthIndicator healthIndicator = new PingHealthIndicator();
|
||||
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UP);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -787,6 +787,9 @@ The following `HealthIndicators` are auto-configured by Spring Boot when appropr
|
||||
|{sc-spring-boot-actuator}/neo4j/Neo4jHealthIndicator.{sc-ext}[`Neo4jHealthIndicator`]
|
||||
|Checks that a Neo4j server is up.
|
||||
|
||||
|{sc-spring-boot-actuator}/health/PingHealthIndicator.{sc-ext}[`PingHealthIndicator`]
|
||||
|Always responds with `UP`.
|
||||
|
||||
|{sc-spring-boot-actuator}/amqp/RabbitHealthIndicator.{sc-ext}[`RabbitHealthIndicator`]
|
||||
|Checks that a Rabbit server is up.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user