Browse Source

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
pull/17939/head
Andy Wilkinson 7 years ago
parent
commit
b43827d626
  1. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/amqp/RabbitHealthContributorAutoConfiguration.java
  2. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthContributorAutoConfiguration.java
  3. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthContributorAutoConfiguration.java
  4. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthContributorAutoConfiguration.java
  5. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthContributorAutoConfiguration.java
  6. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchClientHealthContributorAutoConfiguration.java
  7. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchJestHealthContributorAutoConfiguration.java
  8. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchRestHealthContributorAutoConfiguration.java
  9. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfiguration.java
  10. 13
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorAutoConfiguration.java
  11. 2
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointAutoConfiguration.java
  12. 2
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.java
  13. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/influx/InfluxDbHealthContributorAutoConfiguration.java
  14. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthContributorAutoConfiguration.java
  15. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jms/JmsHealthContributorAutoConfiguration.java
  16. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/ldap/LdapHealthContributorAutoConfiguration.java
  17. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mail/MailHealthContributorAutoConfiguration.java
  18. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthContributorAutoConfiguration.java
  19. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthContributorAutoConfiguration.java
  20. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/neo4j/Neo4jHealthContributorAutoConfiguration.java
  21. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthContributorAutoConfiguration.java
  22. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthContributorAutoConfiguration.java
  23. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/solr/SolrHealthContributorAutoConfiguration.java
  24. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
  25. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/amqp/RabbitHealthContributorAutoConfigurationTests.java
  26. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthContributorAutoConfigurationTests.java
  27. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthContributorAutoConfigurationTests.java
  28. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthContributorAutoConfigurationTests.java
  29. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthContributorAutoConfigurationTests.java
  30. 10
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthContributorAutoConfigurationTests.java
  31. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java
  32. 25
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorAutoConfigurationTests.java
  33. 4
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointAutoConfigurationTests.java
  34. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/influx/InfluxDbHealthContributorAutoConfigurationTests.java
  35. 10
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthContributorAutoConfigurationTests.java
  36. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jms/JmsHealthContributorAutoConfigurationTests.java
  37. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ldap/LdapHealthContributorAutoConfigurationTests.java
  38. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mail/MailHealthContributorAutoConfigurationTests.java
  39. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthContributorAutoConfigurationTests.java
  40. 5
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthContributorAutoConfigurationTests.java
  41. 8
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/neo4j/Neo4jHealthContributorAutoConfigurationTests.java
  42. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthContributorAutoConfigurationTests.java
  43. 5
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthContributorAutoConfigurationTests.java
  44. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/solr/SolrHealthContributorAutoConfigurationTests.java
  45. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java
  46. 2
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ApplicationHealthIndicator.java
  47. 1
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java
  48. 34
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/PingHealthIndicator.java
  49. 1
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java
  50. 36
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/PingHealthIndicatorTests.java
  51. 3
      spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/amqp/RabbitHealthContributorAutoConfiguration.java

@ -22,10 +22,8 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import com.datastax.driver.core.Cluster; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import reactor.core.publisher.Flux; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthContributorAutoConfiguration.java

@ -21,11 +21,9 @@ import com.couchbase.client.java.Cluster; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import reactor.core.publisher.Flux; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchClientHealthContributorAutoConfiguration.java

@ -23,11 +23,9 @@ import org.elasticsearch.client.Client; @@ -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; @@ -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

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchJestHealthContributorAutoConfiguration.java

@ -22,12 +22,10 @@ import io.searchbox.client.JestClient; @@ -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; @@ -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

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchRestHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import org.elasticsearch.client.RestClient; @@ -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; @@ -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

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import com.hazelcast.core.HazelcastInstance; @@ -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; @@ -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> {

13
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorAutoConfiguration.java

@ -16,18 +16,15 @@ @@ -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; @@ -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();
}
}

2
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointAutoConfiguration.java

@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.health; @@ -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; @@ -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,

2
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.java

@ -17,7 +17,6 @@ @@ -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; @@ -34,7 +33,6 @@ import org.springframework.context.annotation.Configuration;
*/
@Deprecated
@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore(HealthContributorAutoConfiguration.class)
public class HealthIndicatorAutoConfiguration {
}

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/influx/InfluxDbHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import org.influxdb.InfluxDB; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthContributorAutoConfiguration.java

@ -27,11 +27,9 @@ import org.springframework.beans.factory.InitializingBean; @@ -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; @@ -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 {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jms/JmsHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import javax.jms.ConnectionFactory; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/ldap/LdapHealthContributorAutoConfiguration.java

@ -20,11 +20,9 @@ import java.util.Map; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mail/MailHealthContributorAutoConfiguration.java

@ -20,11 +20,9 @@ import java.util.Map; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthContributorAutoConfiguration.java

@ -20,11 +20,9 @@ import java.util.Map; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import reactor.core.publisher.Flux; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/neo4j/Neo4jHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import org.neo4j.ogm.session.SessionFactory; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthContributorAutoConfiguration.java

@ -20,11 +20,9 @@ import java.util.Map; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import reactor.core.publisher.Flux; @@ -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; @@ -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> {

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/solr/SolrHealthContributorAutoConfiguration.java

@ -22,11 +22,9 @@ import org.apache.solr.client.solrj.SolrClient; @@ -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; @@ -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> {

6
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

@ -131,6 +131,12 @@ @@ -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",

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/amqp/RabbitHealthContributorAutoConfigurationTests.java

@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; @@ -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 { @@ -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));
}
}

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthContributorAutoConfigurationTests.java

@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; @@ -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 { @@ -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)

6
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthContributorAutoConfigurationTests.java

@ -21,7 +21,6 @@ import org.junit.jupiter.api.Test; @@ -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 { @@ -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));
}
}

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthContributorAutoConfigurationTests.java

@ -21,7 +21,6 @@ import org.junit.jupiter.api.Test; @@ -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 { @@ -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));
}
}

6
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthContributorAutoConfigurationTests.java

@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test; @@ -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 { @@ -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));
}
}

10
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthContributorAutoConfigurationTests.java

@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test; @@ -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 { @@ -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 { @@ -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));
}
}

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java

@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; @@ -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 { @@ -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));
}
}

25
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorAutoConfigurationTests.java

@ -18,9 +18,9 @@ package org.springframework.boot.actuate.autoconfigure.health; @@ -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 { @@ -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));
}

4
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointAutoConfigurationTests.java

@ -175,7 +175,7 @@ class HealthEndpointAutoConfigurationTests { @@ -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 { @@ -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");
});
}

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/influx/InfluxDbHealthContributorAutoConfigurationTests.java

@ -20,7 +20,6 @@ import org.influxdb.InfluxDB; @@ -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 { @@ -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));
}
}

10
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthContributorAutoConfigurationTests.java

@ -21,9 +21,7 @@ import javax.sql.DataSource; @@ -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 { @@ -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 { @@ -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 { @@ -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)

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jms/JmsHealthContributorAutoConfigurationTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.jms; @@ -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 { @@ -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));
}
}

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ldap/LdapHealthContributorAutoConfigurationTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.ldap; @@ -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 { @@ -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));
}
}

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mail/MailHealthContributorAutoConfigurationTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.mail; @@ -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 { @@ -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));
}
}

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthContributorAutoConfigurationTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.mongo; @@ -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 { @@ -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));
}
}

5
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthContributorAutoConfigurationTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.mongo; @@ -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 { @@ -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));
}
}

8
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/neo4j/Neo4jHealthContributorAutoConfigurationTests.java

@ -21,7 +21,6 @@ import org.neo4j.ogm.session.Session; @@ -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 { @@ -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));
});

6
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthContributorAutoConfigurationTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.redis; @@ -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 { @@ -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));
}
}

5
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthContributorAutoConfigurationTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.redis; @@ -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 { @@ -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));
}
}

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/solr/SolrHealthContributorAutoConfigurationTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.solr; @@ -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 { @@ -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));
}
}

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.system; @@ -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 { @@ -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 { @@ -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));
}
}

2
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ApplicationHealthIndicator.java

@ -23,7 +23,9 @@ package org.springframework.boot.actuate.health; @@ -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() {

1
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java

@ -23,7 +23,6 @@ package org.springframework.boot.actuate.health; @@ -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 {

34
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/PingHealthIndicator.java

@ -0,0 +1,34 @@ @@ -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();
}
}

1
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java

@ -25,6 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -25,6 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Phillip Webb
*/
@Deprecated
class ApplicationHealthIndicatorTests {
@Test

36
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/PingHealthIndicatorTests.java

@ -0,0 +1,36 @@ @@ -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);
}
}

3
spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

@ -787,6 +787,9 @@ The following `HealthIndicators` are auto-configured by Spring Boot when appropr @@ -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.

Loading…
Cancel
Save