Browse Source

Move Elasticsearch health auto-configuration into spring-boot-elasticsearch

See gh-46091
pull/46230/head
Andy Wilkinson 7 months ago
parent
commit
639d9ef51c
  1. 22
      spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json
  2. 1
      spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  3. 2
      spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/data/elasticsearch/ElasticsearchReactiveHealthContributorAutoConfigurationTests.java
  4. 2
      spring-boot-project/spring-boot-elasticsearch/build.gradle
  5. 8
      spring-boot-project/spring-boot-elasticsearch/src/main/java/org/springframework/boot/elasticsearch/actuate/health/autoconfigure/ElasticsearchRestHealthContributorAutoConfiguration.java
  6. 4
      spring-boot-project/spring-boot-elasticsearch/src/main/java/org/springframework/boot/elasticsearch/actuate/health/autoconfigure/package-info.java
  7. 22
      spring-boot-project/spring-boot-elasticsearch/src/main/resources/META-INF/additional-spring-configuration-metadata.json
  8. 3
      spring-boot-project/spring-boot-elasticsearch/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  9. 2
      spring-boot-project/spring-boot-elasticsearch/src/test/java/org/springframework/boot/elasticsearch/actuate/health/autoconfigure/ElasticsearchRestHealthContributorAutoConfigurationTests.java

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

@ -59,28 +59,6 @@ @@ -59,28 +59,6 @@
"description": "Whether to enable disk space health check.",
"defaultValue": true
},
{
"name": "management.health.elasticsearch.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable Elasticsearch health check.",
"defaultValue": true
},
{
"name": "management.health.elasticsearch.indices",
"type": "java.util.List<java.lang.String>",
"description": "Comma-separated index names.",
"deprecation": {
"level": "error"
}
},
{
"name": "management.health.elasticsearch.response-timeout",
"type": "java.time.Duration",
"description": "Time to wait for a response from the cluster.",
"deprecation": {
"level": "error"
}
},
{
"name": "management.health.influxdb.enabled",
"type": "java.lang.Boolean",

1
spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@ -13,7 +13,6 @@ org.springframework.boot.actuate.autoconfigure.data.mongo.MongoHealthContributor @@ -13,7 +13,6 @@ org.springframework.boot.actuate.autoconfigure.data.mongo.MongoHealthContributor
org.springframework.boot.actuate.autoconfigure.data.mongo.MongoReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.data.redis.RedisHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.data.redis.RedisReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchRestHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.endpoint.jackson.JacksonEndpointAutoConfiguration
org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointAutoConfiguration
org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration

2
spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/data/elasticsearch/ElasticsearchReactiveHealthContributorAutoConfigurationTests.java

@ -18,12 +18,12 @@ package org.springframework.boot.actuate.autoconfigure.data.elasticsearch; @@ -18,12 +18,12 @@ package org.springframework.boot.actuate.autoconfigure.data.elasticsearch;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchRestHealthContributorAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.data.elasticsearch.actuate.health.ElasticsearchReactiveHealthIndicator;
import org.springframework.boot.data.elasticsearch.autoconfigure.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.elasticsearch.actuate.health.ElasticsearchRestClientHealthIndicator;
import org.springframework.boot.elasticsearch.actuate.health.autoconfigure.ElasticsearchRestHealthContributorAutoConfiguration;
import org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchRestClientAutoConfiguration;
import org.springframework.boot.elasticsearch.autoconfigure.ReactiveElasticsearchClientAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

2
spring-boot-project/spring-boot-elasticsearch/build.gradle

@ -30,7 +30,7 @@ dependencies { @@ -30,7 +30,7 @@ dependencies {
api(project(":spring-boot-project:spring-boot"))
api("org.elasticsearch.client:elasticsearch-rest-client")
optional(project(":spring-boot-project:spring-boot-actuator"))
optional(project(":spring-boot-project:spring-boot-actuator-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-jsonb"))
optional(project(":spring-boot-project:spring-boot-reactor"))

8
spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchRestHealthContributorAutoConfiguration.java → spring-boot-project/spring-boot-elasticsearch/src/main/java/org/springframework/boot/elasticsearch/actuate/health/autoconfigure/ElasticsearchRestHealthContributorAutoConfiguration.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.elasticsearch;
package org.springframework.boot.elasticsearch.actuate.health.autoconfigure;
import org.elasticsearch.client.RestClient;
@ -28,6 +28,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; @@ -28,6 +28,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.elasticsearch.actuate.health.ElasticsearchRestClientHealthIndicator;
import org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchRestClientAutoConfiguration;
import org.springframework.context.annotation.Bean;
/**
@ -37,9 +38,8 @@ import org.springframework.context.annotation.Bean; @@ -37,9 +38,8 @@ import org.springframework.context.annotation.Bean;
* @author Artsiom Yudovin
* @since 2.1.1
*/
@AutoConfiguration(
afterName = "org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchRestClientAutoConfiguration")
@ConditionalOnClass({ RestClient.class, ElasticsearchRestClientHealthIndicator.class })
@AutoConfiguration(after = ElasticsearchRestClientAutoConfiguration.class)
@ConditionalOnClass({ RestClient.class, ConditionalOnEnabledHealthIndicator.class })
@ConditionalOnBean(RestClient.class)
@ConditionalOnEnabledHealthIndicator("elasticsearch")
public class ElasticsearchRestHealthContributorAutoConfiguration

4
spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/package-info.java → spring-boot-project/spring-boot-elasticsearch/src/main/java/org/springframework/boot/elasticsearch/actuate/health/autoconfigure/package-info.java

@ -15,6 +15,6 @@ @@ -15,6 +15,6 @@
*/
/**
* Auto-configuration for actuator Elasticsearch concerns.
* Auto-configuration for Elasticsearch health integration.
*/
package org.springframework.boot.actuate.autoconfigure.elasticsearch;
package org.springframework.boot.elasticsearch.actuate.health.autoconfigure;

22
spring-boot-project/spring-boot-elasticsearch/src/main/resources/META-INF/additional-spring-configuration-metadata.json

@ -1,6 +1,28 @@ @@ -1,6 +1,28 @@
{
"groups": [],
"properties": [
{
"name": "management.health.elasticsearch.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable Elasticsearch health check.",
"defaultValue": true
},
{
"name": "management.health.elasticsearch.indices",
"type": "java.util.List<java.lang.String>",
"description": "Comma-separated index names.",
"deprecation": {
"level": "error"
}
},
{
"name": "management.health.elasticsearch.response-timeout",
"type": "java.time.Duration",
"description": "Time to wait for a response from the cluster.",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.elasticsearch.jest.connection-timeout",
"type": "java.time.Duration",

3
spring-boot-project/spring-boot-elasticsearch/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
org.springframework.boot.elasticsearch.actuate.health.autoconfigure.ElasticsearchRestHealthContributorAutoConfiguration
org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchClientAutoConfiguration
org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchRestClientAutoConfiguration
org.springframework.boot.elasticsearch.autoconfigure.ReactiveElasticsearchClientAutoConfiguration
org.springframework.boot.elasticsearch.autoconfigure.ReactiveElasticsearchClientAutoConfiguration

2
spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchRestHealthContributorAutoConfigurationTests.java → spring-boot-project/spring-boot-elasticsearch/src/test/java/org/springframework/boot/elasticsearch/actuate/health/autoconfigure/ElasticsearchRestHealthContributorAutoConfigurationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.elasticsearch;
package org.springframework.boot.elasticsearch.actuate.health.autoconfigure;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
Loading…
Cancel
Save