Improve filtering of actuator auto-configurations
This commit splits auto-configurations that require different environments so that they can be filtered early. Closes gh-12260pull/11125/merge
parent
9bc6dbd8d8
commit
bdd8e53124
@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2018 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
|
|
||||||
*
|
|
||||||
* http://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.autoconfigure.cassandra;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration;
|
|
||||||
import org.springframework.boot.actuate.cassandra.CassandraHealthIndicator;
|
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration for {@link CassandraHealthIndicator}.
|
|
||||||
*
|
|
||||||
* @author Julien Dubois
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnClass(CassandraOperations.class)
|
|
||||||
@ConditionalOnBean(CassandraOperations.class)
|
|
||||||
class CassandraHealthIndicatorConfiguration extends
|
|
||||||
CompositeHealthIndicatorConfiguration<CassandraHealthIndicator, CassandraOperations> {
|
|
||||||
|
|
||||||
private final Map<String, CassandraOperations> cassandraOperations;
|
|
||||||
|
|
||||||
CassandraHealthIndicatorConfiguration(
|
|
||||||
Map<String, CassandraOperations> cassandraOperations) {
|
|
||||||
this.cassandraOperations = cassandraOperations;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean(name = "cassandraHealthIndicator")
|
|
||||||
public HealthIndicator cassandraHealthIndicator() {
|
|
||||||
return createHealthIndicator(this.cassandraOperations);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
22
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfiguration.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfiguration.java
22
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfiguration.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfiguration.java
@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2018 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
|
|
||||||
*
|
|
||||||
* http://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.autoconfigure.couchbase;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration;
|
|
||||||
import org.springframework.boot.actuate.couchbase.CouchbaseHealthIndicator;
|
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
|
||||||
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.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.data.couchbase.core.CouchbaseOperations;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration for {@link CouchbaseHealthIndicator}.
|
|
||||||
*
|
|
||||||
* @author Eddú Meléndez
|
|
||||||
* @author Stephane Nicoll
|
|
||||||
* @since 2.0.0
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnClass(CouchbaseOperations.class)
|
|
||||||
@ConditionalOnBean(CouchbaseOperations.class)
|
|
||||||
@EnableConfigurationProperties(CouchbaseHealthIndicatorProperties.class)
|
|
||||||
public class CouchbaseHealthIndicatorConfiguration extends
|
|
||||||
CompositeHealthIndicatorConfiguration<CouchbaseHealthIndicator, CouchbaseOperations> {
|
|
||||||
|
|
||||||
private final Map<String, CouchbaseOperations> couchbaseOperations;
|
|
||||||
|
|
||||||
private final CouchbaseHealthIndicatorProperties properties;
|
|
||||||
|
|
||||||
CouchbaseHealthIndicatorConfiguration(
|
|
||||||
Map<String, CouchbaseOperations> couchbaseOperations,
|
|
||||||
CouchbaseHealthIndicatorProperties properties) {
|
|
||||||
this.couchbaseOperations = couchbaseOperations;
|
|
||||||
this.properties = properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean(name = "couchbaseHealthIndicator")
|
|
||||||
public HealthIndicator couchbaseHealthIndicator() {
|
|
||||||
return createHealthIndicator(this.couchbaseOperations);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected CouchbaseHealthIndicator createHealthIndicator(
|
|
||||||
CouchbaseOperations couchbaseOperations) {
|
|
||||||
return new CouchbaseHealthIndicator(couchbaseOperations,
|
|
||||||
this.properties.getTimeout());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
19
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfiguration.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfiguration.java
19
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfiguration.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfiguration.java
@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2018 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
|
||||||
|
*
|
||||||
|
* http://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.autoconfigure.elasticsearch;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.elasticsearch.client.Client;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration;
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration;
|
||||||
|
import org.springframework.boot.actuate.elasticsearch.ElasticsearchHealthIndicator;
|
||||||
|
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||||
|
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;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link EnableAutoConfiguration Auto-configuration} for
|
||||||
|
* {@link ElasticsearchHealthIndicator} using the Elasticsearch {@link Client}.
|
||||||
|
*
|
||||||
|
* @author Stephane Nicoll
|
||||||
|
* @since 2.1.0
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnClass(Client.class)
|
||||||
|
@ConditionalOnBean(Client.class)
|
||||||
|
@ConditionalOnEnabledHealthIndicator("elasticsearch")
|
||||||
|
@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class)
|
||||||
|
@AutoConfigureAfter(ElasticsearchAutoConfiguration.class)
|
||||||
|
@EnableConfigurationProperties(ElasticsearchHealthIndicatorProperties.class)
|
||||||
|
public class ElasticSearchClientHealthIndicatorAutoConfiguration extends
|
||||||
|
CompositeHealthIndicatorConfiguration<ElasticsearchHealthIndicator, Client> {
|
||||||
|
|
||||||
|
private final Map<String, Client> clients;
|
||||||
|
|
||||||
|
private final ElasticsearchHealthIndicatorProperties properties;
|
||||||
|
|
||||||
|
public ElasticSearchClientHealthIndicatorAutoConfiguration(
|
||||||
|
Map<String, Client> clients,
|
||||||
|
ElasticsearchHealthIndicatorProperties properties) {
|
||||||
|
this.clients = clients;
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(name = "elasticsearchHealthIndicator")
|
||||||
|
public HealthIndicator elasticsearchHealthIndicator() {
|
||||||
|
return createHealthIndicator(this.clients);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ElasticsearchHealthIndicator createHealthIndicator(Client client) {
|
||||||
|
Duration responseTimeout = this.properties.getResponseTimeout();
|
||||||
|
return new ElasticsearchHealthIndicator(client,
|
||||||
|
(responseTimeout != null) ? responseTimeout.toMillis() : 100,
|
||||||
|
this.properties.getIndices());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2018 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
|
||||||
|
*
|
||||||
|
* http://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.autoconfigure.elasticsearch;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import io.searchbox.client.JestClient;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration;
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration;
|
||||||
|
import org.springframework.boot.actuate.elasticsearch.ElasticsearchHealthIndicator;
|
||||||
|
import org.springframework.boot.actuate.elasticsearch.ElasticsearchJestHealthIndicator;
|
||||||
|
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||||
|
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;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link EnableAutoConfiguration Auto-configuration} for
|
||||||
|
* {@link ElasticsearchHealthIndicator} using the {@link JestClient}.
|
||||||
|
*
|
||||||
|
* @author Stephane Nicoll
|
||||||
|
* @since 2.1.0
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnClass(JestClient.class)
|
||||||
|
@ConditionalOnBean(JestClient.class)
|
||||||
|
@ConditionalOnEnabledHealthIndicator("elasticsearch")
|
||||||
|
@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class)
|
||||||
|
@AutoConfigureAfter({ JestAutoConfiguration.class,
|
||||||
|
ElasticSearchClientHealthIndicatorAutoConfiguration.class })
|
||||||
|
public class ElasticSearchJestHealthIndicatorAutoConfiguration extends
|
||||||
|
CompositeHealthIndicatorConfiguration<ElasticsearchJestHealthIndicator, JestClient> {
|
||||||
|
|
||||||
|
private final Map<String, JestClient> clients;
|
||||||
|
|
||||||
|
public ElasticSearchJestHealthIndicatorAutoConfiguration(
|
||||||
|
Map<String, JestClient> clients) {
|
||||||
|
this.clients = clients;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(name = "elasticsearchHealthIndicator")
|
||||||
|
public HealthIndicator elasticsearchHealthIndicator() {
|
||||||
|
return createHealthIndicator(this.clients);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ElasticsearchJestHealthIndicator createHealthIndicator(JestClient client) {
|
||||||
|
return new ElasticsearchJestHealthIndicator(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,117 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2018 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
|
|
||||||
*
|
|
||||||
* http://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.autoconfigure.elasticsearch;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import io.searchbox.client.JestClient;
|
|
||||||
import org.elasticsearch.client.Client;
|
|
||||||
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration;
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration;
|
|
||||||
import org.springframework.boot.actuate.elasticsearch.ElasticsearchHealthIndicator;
|
|
||||||
import org.springframework.boot.actuate.elasticsearch.ElasticsearchJestHealthIndicator;
|
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
|
||||||
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;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
|
|
||||||
import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration;
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link EnableAutoConfiguration Auto-configuration} for
|
|
||||||
* {@link ElasticsearchHealthIndicator}.
|
|
||||||
*
|
|
||||||
* @author Binwei Yang
|
|
||||||
* @author Andy Wilkinson
|
|
||||||
* @author Stephane Nicoll
|
|
||||||
* @since 2.0.0
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnEnabledHealthIndicator("elasticsearch")
|
|
||||||
@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class)
|
|
||||||
@AutoConfigureAfter({ ElasticsearchAutoConfiguration.class, JestAutoConfiguration.class })
|
|
||||||
public class ElasticsearchHealthIndicatorAutoConfiguration {
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnClass(Client.class)
|
|
||||||
@ConditionalOnBean(Client.class)
|
|
||||||
@EnableConfigurationProperties(ElasticsearchHealthIndicatorProperties.class)
|
|
||||||
static class ElasticsearchClientHealthIndicatorConfiguration extends
|
|
||||||
CompositeHealthIndicatorConfiguration<ElasticsearchHealthIndicator, Client> {
|
|
||||||
|
|
||||||
private final Map<String, Client> clients;
|
|
||||||
|
|
||||||
private final ElasticsearchHealthIndicatorProperties properties;
|
|
||||||
|
|
||||||
ElasticsearchClientHealthIndicatorConfiguration(Map<String, Client> clients,
|
|
||||||
ElasticsearchHealthIndicatorProperties properties) {
|
|
||||||
this.clients = clients;
|
|
||||||
this.properties = properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean(name = "elasticsearchHealthIndicator")
|
|
||||||
public HealthIndicator elasticsearchHealthIndicator() {
|
|
||||||
return createHealthIndicator(this.clients);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ElasticsearchHealthIndicator createHealthIndicator(Client client) {
|
|
||||||
Duration responseTimeout = this.properties.getResponseTimeout();
|
|
||||||
return new ElasticsearchHealthIndicator(client,
|
|
||||||
(responseTimeout != null) ? responseTimeout.toMillis() : 100,
|
|
||||||
this.properties.getIndices());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnClass(JestClient.class)
|
|
||||||
@ConditionalOnBean(JestClient.class)
|
|
||||||
static class ElasticsearchJestHealthIndicatorConfiguration extends
|
|
||||||
CompositeHealthIndicatorConfiguration<ElasticsearchJestHealthIndicator, JestClient> {
|
|
||||||
|
|
||||||
private final Map<String, JestClient> clients;
|
|
||||||
|
|
||||||
ElasticsearchJestHealthIndicatorConfiguration(Map<String, JestClient> clients) {
|
|
||||||
this.clients = clients;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean(name = "elasticsearchHealthIndicator")
|
|
||||||
public HealthIndicator elasticsearchHealthIndicator() {
|
|
||||||
return createHealthIndicator(this.clients);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ElasticsearchJestHealthIndicator createHealthIndicator(
|
|
||||||
JestClient client) {
|
|
||||||
return new ElasticsearchJestHealthIndicator(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2018 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
|
|
||||||
*
|
|
||||||
* http://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.autoconfigure.mongo;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration;
|
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
|
||||||
import org.springframework.boot.actuate.mongo.MongoHealthIndicator;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration for {@link MongoHealthIndicator}.
|
|
||||||
*
|
|
||||||
* @author Stephane Nicoll
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnClass(MongoTemplate.class)
|
|
||||||
@ConditionalOnBean(MongoTemplate.class)
|
|
||||||
class MongoHealthIndicatorConfiguration extends
|
|
||||||
CompositeHealthIndicatorConfiguration<MongoHealthIndicator, MongoTemplate> {
|
|
||||||
|
|
||||||
private final Map<String, MongoTemplate> mongoTemplates;
|
|
||||||
|
|
||||||
MongoHealthIndicatorConfiguration(Map<String, MongoTemplate> mongoTemplates) {
|
|
||||||
this.mongoTemplates = mongoTemplates;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean(name = "mongoHealthIndicator")
|
|
||||||
public HealthIndicator mongoHealthIndicator() {
|
|
||||||
return createHealthIndicator(this.mongoTemplates);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
21
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfiguration.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfiguration.java
21
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfiguration.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfiguration.java
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2017 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
|
|
||||||
*
|
|
||||||
* http://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.autoconfigure.redis;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration;
|
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
|
||||||
import org.springframework.boot.actuate.redis.RedisHealthIndicator;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration for {@link RedisHealthIndicator}.
|
|
||||||
*
|
|
||||||
* @author Christian Dupuis
|
|
||||||
* @author Richard Santana
|
|
||||||
* @author Stephane Nicoll
|
|
||||||
* @author Mark Paluch
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnClass(RedisConnectionFactory.class)
|
|
||||||
@ConditionalOnBean(RedisConnectionFactory.class)
|
|
||||||
class RedisHealthIndicatorConfiguration extends
|
|
||||||
CompositeHealthIndicatorConfiguration<RedisHealthIndicator, RedisConnectionFactory> {
|
|
||||||
|
|
||||||
private final Map<String, RedisConnectionFactory> redisConnectionFactories;
|
|
||||||
|
|
||||||
RedisHealthIndicatorConfiguration(
|
|
||||||
Map<String, RedisConnectionFactory> redisConnectionFactories) {
|
|
||||||
this.redisConnectionFactories = redisConnectionFactories;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean(name = "redisHealthIndicator")
|
|
||||||
public HealthIndicator redisHealthIndicator() {
|
|
||||||
return createHealthIndicator(this.redisConnectionFactories);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
17
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfiguration.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfiguration.java
17
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfiguration.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfiguration.java
9
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfigurationTests.java
9
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfigurationTests.java
4
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfigurationTests.java
4
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfigurationTests.java
9
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfigurationTests.java
9
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfigurationTests.java
6
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfigurationTests.java
6
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfigurationTests.java
8
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfigurationTests.java
8
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfigurationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfigurationTests.java
Loading…
Reference in New Issue