diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorAutoConfiguration.java index a514e46486..b104b1035e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorAutoConfiguration.java @@ -16,39 +16,57 @@ package org.springframework.boot.actuate.autoconfigure.cassandra; +import java.util.Map; + import com.datastax.driver.core.Cluster; +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.cassandra.CassandraHealthIndicator; -import org.springframework.boot.actuate.cassandra.CassandraReactiveHealthIndicator; +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.cassandra.CassandraAutoConfiguration; +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.cassandra.CassandraDataAutoConfiguration; -import org.springframework.boot.autoconfigure.data.cassandra.CassandraReactiveDataAutoConfiguration; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; +import org.springframework.data.cassandra.core.CassandraOperations; /** - * {@link EnableAutoConfiguration Auto-configuration} for {@link CassandraHealthIndicator} - * and {@link CassandraReactiveHealthIndicator}. + * {@link EnableAutoConfiguration Auto-configuration} for + * {@link CassandraHealthIndicator}. * * @author Julien Dubois * @author Stephane Nicoll - * @since 2.0.0 + * @since 2.1.0 */ @Configuration -@ConditionalOnClass(Cluster.class) +@ConditionalOnClass({ Cluster.class, CassandraOperations.class }) +@ConditionalOnBean(CassandraOperations.class) @ConditionalOnEnabledHealthIndicator("cassandra") @AutoConfigureBefore(HealthIndicatorAutoConfiguration.class) @AutoConfigureAfter({ CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class, - CassandraReactiveDataAutoConfiguration.class }) -@Import({ CassandraReactiveHealthIndicatorConfiguration.class, - CassandraHealthIndicatorConfiguration.class }) -public class CassandraHealthIndicatorAutoConfiguration { + CassandraReactiveHealthIndicatorAutoConfiguration.class }) +public class CassandraHealthIndicatorAutoConfiguration extends + CompositeHealthIndicatorConfiguration { + + private final Map cassandraOperations; + + public CassandraHealthIndicatorAutoConfiguration( + Map cassandraOperations) { + this.cassandraOperations = cassandraOperations; + } + + @Bean + @ConditionalOnMissingBean(name = "cassandraHealthIndicator") + public HealthIndicator cassandraHealthIndicator() { + return createHealthIndicator(this.cassandraOperations); + } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorConfiguration.java deleted file mode 100644 index 0bbb8224bd..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorConfiguration.java +++ /dev/null @@ -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 { - - private final Map cassandraOperations; - - CassandraHealthIndicatorConfiguration( - Map cassandraOperations) { - this.cassandraOperations = cassandraOperations; - } - - @Bean - @ConditionalOnMissingBean(name = "cassandraHealthIndicator") - public HealthIndicator cassandraHealthIndicator() { - return createHealthIndicator(this.cassandraOperations); - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfiguration.java similarity index 65% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfiguration.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfiguration.java index d41c769f9a..2cc7feca17 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfiguration.java @@ -17,31 +17,45 @@ package org.springframework.boot.actuate.autoconfigure.cassandra; import java.util.Map; +import com.datastax.driver.core.Cluster; +import reactor.core.publisher.Flux; + import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthIndicatorConfiguration; +import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; +import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration; import org.springframework.boot.actuate.cassandra.CassandraReactiveHealthIndicator; import org.springframework.boot.actuate.health.ReactiveHealthIndicator; +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.cassandra.CassandraReactiveDataAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.cassandra.core.ReactiveCassandraOperations; /** - * Configuration for {@link CassandraReactiveHealthIndicator}. + * {@link EnableAutoConfiguration Auto-configuration} for + * {@link CassandraReactiveHealthIndicator}. * * @author Artsiom Yudovin * @author Stephane Nicoll + * @since 2.1.0 */ @Configuration -@ConditionalOnClass(ReactiveCassandraOperations.class) +@ConditionalOnClass({ Cluster.class, ReactiveCassandraOperations.class, Flux.class }) @ConditionalOnBean(ReactiveCassandraOperations.class) -class CassandraReactiveHealthIndicatorConfiguration extends +@ConditionalOnEnabledHealthIndicator("cassandra") +@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class) +@AutoConfigureAfter(CassandraReactiveDataAutoConfiguration.class) +public class CassandraReactiveHealthIndicatorAutoConfiguration extends CompositeReactiveHealthIndicatorConfiguration { private final Map reactiveCassandraOperations; - CassandraReactiveHealthIndicatorConfiguration( + public CassandraReactiveHealthIndicatorAutoConfiguration( Map reactiveCassandraOperations) { this.reactiveCassandraOperations = reactiveCassandraOperations; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfiguration.java index 13f1899f7e..3b6d9c0294 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfiguration.java @@ -13,23 +13,29 @@ * 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 com.couchbase.client.java.Bucket; +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.couchbase.CouchbaseHealthIndicator; +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.couchbase.CouchbaseAutoConfiguration; import org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration; -import org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveDataAutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; +import org.springframework.data.couchbase.core.CouchbaseOperations; /** * {@link EnableAutoConfiguration Auto-configuration} for @@ -37,17 +43,42 @@ import org.springframework.context.annotation.Import; * * @author Eddú Meléndez * @author Stephane Nicoll - * @since 2.0.0 + * @since 2.1.0 */ @Configuration -@ConditionalOnClass(Bucket.class) +@ConditionalOnClass({ Bucket.class, CouchbaseOperations.class }) +@ConditionalOnBean(CouchbaseOperations.class) @ConditionalOnEnabledHealthIndicator("couchbase") @AutoConfigureBefore(HealthIndicatorAutoConfiguration.class) @AutoConfigureAfter({ CouchbaseAutoConfiguration.class, CouchbaseDataAutoConfiguration.class, - CouchbaseReactiveDataAutoConfiguration.class }) -@Import({ CouchbaseReactiveHealthIndicatorConfiguration.class, - CouchbaseHealthIndicatorConfiguration.class }) -public class CouchbaseHealthIndicatorAutoConfiguration { + CouchbaseReactiveHealthIndicatorAutoConfiguration.class }) +@EnableConfigurationProperties(CouchbaseHealthIndicatorProperties.class) +public class CouchbaseHealthIndicatorAutoConfiguration extends + CompositeHealthIndicatorConfiguration { + + private final Map couchbaseOperations; + + private final CouchbaseHealthIndicatorProperties properties; + + public CouchbaseHealthIndicatorAutoConfiguration( + Map 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()); + } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorConfiguration.java deleted file mode 100644 index 2d8f081e7b..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorConfiguration.java +++ /dev/null @@ -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 { - - private final Map couchbaseOperations; - - private final CouchbaseHealthIndicatorProperties properties; - - CouchbaseHealthIndicatorConfiguration( - Map 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()); - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfiguration.java similarity index 71% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfiguration.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfiguration.java index 23ad168ad7..bbd02e0b30 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfiguration.java @@ -17,38 +17,49 @@ package org.springframework.boot.actuate.autoconfigure.couchbase; import java.util.Map; +import com.couchbase.client.java.Bucket; import reactor.core.publisher.Flux; import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthIndicatorConfiguration; +import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; +import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration; import org.springframework.boot.actuate.couchbase.CouchbaseReactiveHealthIndicator; import org.springframework.boot.actuate.health.ReactiveHealthIndicator; +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.couchbase.CouchbaseReactiveDataAutoConfiguration; 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.RxJavaCouchbaseOperations; /** - * Configuration for {@link CouchbaseReactiveHealthIndicator}. + * {@link EnableAutoConfiguration Auto-configuration} for + * {@link CouchbaseReactiveHealthIndicator}. * * @author Mikalai Lushchytski * @author Stephane Nicoll * @since 2.1.0 */ @Configuration -@ConditionalOnClass({ RxJavaCouchbaseOperations.class, Flux.class }) +@ConditionalOnClass({ Bucket.class, RxJavaCouchbaseOperations.class, Flux.class }) @ConditionalOnBean(RxJavaCouchbaseOperations.class) +@ConditionalOnEnabledHealthIndicator("couchbase") +@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class) +@AutoConfigureAfter(CouchbaseReactiveDataAutoConfiguration.class) @EnableConfigurationProperties(CouchbaseHealthIndicatorProperties.class) -public class CouchbaseReactiveHealthIndicatorConfiguration extends +public class CouchbaseReactiveHealthIndicatorAutoConfiguration extends CompositeReactiveHealthIndicatorConfiguration { private final Map couchbaseOperations; private final CouchbaseHealthIndicatorProperties properties; - CouchbaseReactiveHealthIndicatorConfiguration( + public CouchbaseReactiveHealthIndicatorAutoConfiguration( Map couchbaseOperations, CouchbaseHealthIndicatorProperties properties) { this.couchbaseOperations = couchbaseOperations; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchClientHealthIndicatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchClientHealthIndicatorAutoConfiguration.java new file mode 100644 index 0000000000..146132fbf4 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchClientHealthIndicatorAutoConfiguration.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 { + + private final Map clients; + + private final ElasticsearchHealthIndicatorProperties properties; + + public ElasticSearchClientHealthIndicatorAutoConfiguration( + Map 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()); + } + +} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchJestHealthIndicatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchJestHealthIndicatorAutoConfiguration.java new file mode 100644 index 0000000000..77324a5828 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticSearchJestHealthIndicatorAutoConfiguration.java @@ -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 { + + private final Map clients; + + public ElasticSearchJestHealthIndicatorAutoConfiguration( + Map 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); + } + +} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfiguration.java deleted file mode 100644 index 47ea3b0c54..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfiguration.java +++ /dev/null @@ -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 { - - private final Map clients; - - private final ElasticsearchHealthIndicatorProperties properties; - - ElasticsearchClientHealthIndicatorConfiguration(Map 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 { - - private final Map clients; - - ElasticsearchJestHealthIndicatorConfiguration(Map 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); - } - - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorAutoConfiguration.java index 6af6118d67..4c136167f3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorAutoConfiguration.java @@ -16,32 +16,51 @@ package org.springframework.boot.actuate.autoconfigure.mongo; +import java.util.Map; + +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.health.HealthIndicator; 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; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; -import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; +import org.springframework.data.mongodb.core.MongoTemplate; /** * {@link EnableAutoConfiguration Auto-configuration} for {@link MongoHealthIndicator}. * - * @author Christian Dupuis * @author Stephane Nicoll - * @since 2.0.0 + * @since 2.1.0 */ @Configuration +@ConditionalOnClass(MongoTemplate.class) +@ConditionalOnBean(MongoTemplate.class) @ConditionalOnEnabledHealthIndicator("mongo") @AutoConfigureBefore(HealthIndicatorAutoConfiguration.class) @AutoConfigureAfter({ MongoAutoConfiguration.class, MongoDataAutoConfiguration.class, - MongoReactiveDataAutoConfiguration.class }) -@Import({ MongoReactiveHealthIndicatorConfiguration.class, - MongoHealthIndicatorConfiguration.class }) -public class MongoHealthIndicatorAutoConfiguration { + MongoReactiveHealthIndicatorAutoConfiguration.class }) +public class MongoHealthIndicatorAutoConfiguration extends + CompositeHealthIndicatorConfiguration { + + private final Map mongoTemplates; + + MongoHealthIndicatorAutoConfiguration(Map mongoTemplates) { + this.mongoTemplates = mongoTemplates; + } + + @Bean + @ConditionalOnMissingBean(name = "mongoHealthIndicator") + public HealthIndicator mongoHealthIndicator() { + return createHealthIndicator(this.mongoTemplates); + } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorConfiguration.java deleted file mode 100644 index 91bffa9d64..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorConfiguration.java +++ /dev/null @@ -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 { - - private final Map mongoTemplates; - - MongoHealthIndicatorConfiguration(Map mongoTemplates) { - this.mongoTemplates = mongoTemplates; - } - - @Bean - @ConditionalOnMissingBean(name = "mongoHealthIndicator") - public HealthIndicator mongoHealthIndicator() { - return createHealthIndicator(this.mongoTemplates); - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfiguration.java similarity index 66% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfiguration.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfiguration.java index ffc6735b31..f70f10c7cd 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfiguration.java @@ -18,30 +18,43 @@ package org.springframework.boot.actuate.autoconfigure.mongo; import java.util.Map; +import reactor.core.publisher.Flux; + import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthIndicatorConfiguration; +import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; +import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration; import org.springframework.boot.actuate.health.ReactiveHealthIndicator; 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; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.core.ReactiveMongoTemplate; /** - * Configuration for {@link MongoReactiveHealthIndicator}. + * {@link EnableAutoConfiguration Auto-configuration} for + * {@link MongoReactiveHealthIndicator}. * * @author Stephane Nicoll + * @since 2.1.0 */ @Configuration -@ConditionalOnClass(ReactiveMongoTemplate.class) +@ConditionalOnClass({ ReactiveMongoTemplate.class, Flux.class }) @ConditionalOnBean(ReactiveMongoTemplate.class) -class MongoReactiveHealthIndicatorConfiguration extends +@ConditionalOnEnabledHealthIndicator("mongo") +@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class) +@AutoConfigureAfter(MongoReactiveDataAutoConfiguration.class) +public class MongoReactiveHealthIndicatorAutoConfiguration extends CompositeReactiveHealthIndicatorConfiguration { private final Map reactiveMongoTemplate; - MongoReactiveHealthIndicatorConfiguration( + MongoReactiveHealthIndicatorAutoConfiguration( Map reactiveMongoTemplate) { this.reactiveMongoTemplate = reactiveMongoTemplate; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorAutoConfiguration.java index c5be3c9ac1..60bbbf1124 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorAutoConfiguration.java @@ -16,30 +16,54 @@ package org.springframework.boot.actuate.autoconfigure.redis; +import java.util.Map; + +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.health.HealthIndicator; import org.springframework.boot.actuate.redis.RedisHealthIndicator; -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; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; +import org.springframework.data.redis.connection.RedisConnectionFactory; /** - * {@link EnableAutoConfiguration Auto-configuration} for {@link RedisHealthIndicator} and - * {@link RedisReactiveHealthIndicator}. + * {@link EnableAutoConfiguration Auto-configuration} for {@link RedisHealthIndicator}. * - * @author Phillip Webb - * @since 2.0.0 + * @author Christian Dupuis + * @author Richard Santana + * @author Stephane Nicoll + * @author Mark Paluch + * @since 2.1.0 */ @Configuration +@ConditionalOnClass(RedisConnectionFactory.class) +@ConditionalOnBean(RedisConnectionFactory.class) @ConditionalOnEnabledHealthIndicator("redis") @AutoConfigureBefore(HealthIndicatorAutoConfiguration.class) -@AutoConfigureAfter(RedisAutoConfiguration.class) -@Import({ RedisReactiveHealthIndicatorConfiguration.class, - RedisHealthIndicatorConfiguration.class }) -public class RedisHealthIndicatorAutoConfiguration { +@AutoConfigureAfter({ RedisAutoConfiguration.class, + RedisReactiveHealthIndicatorAutoConfiguration.class }) +public class RedisHealthIndicatorAutoConfiguration extends + CompositeHealthIndicatorConfiguration { + + private final Map redisConnectionFactories; + + public RedisHealthIndicatorAutoConfiguration( + Map redisConnectionFactories) { + this.redisConnectionFactories = redisConnectionFactories; + } + + @Bean + @ConditionalOnMissingBean(name = "redisHealthIndicator") + public HealthIndicator redisHealthIndicator() { + return createHealthIndicator(this.redisConnectionFactories); + } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorConfiguration.java deleted file mode 100644 index 3af0bfc6b7..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorConfiguration.java +++ /dev/null @@ -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 { - - private final Map redisConnectionFactories; - - RedisHealthIndicatorConfiguration( - Map redisConnectionFactories) { - this.redisConnectionFactories = redisConnectionFactories; - } - - @Bean - @ConditionalOnMissingBean(name = "redisHealthIndicator") - public HealthIndicator redisHealthIndicator() { - return createHealthIndicator(this.redisConnectionFactories); - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfiguration.java similarity index 71% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfiguration.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfiguration.java index 291955a68e..bbab390550 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfiguration.java @@ -21,32 +21,43 @@ import java.util.Map; import reactor.core.publisher.Flux; import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthIndicatorConfiguration; +import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; +import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration; import org.springframework.boot.actuate.health.ReactiveHealthIndicator; 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; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory; /** - * Configuration for {@link RedisReactiveHealthIndicator}. + * {@link EnableAutoConfiguration Auto-configuration} for + * {@link RedisReactiveHealthIndicator}. * * @author Christian Dupuis * @author Richard Santana * @author Stephane Nicoll * @author Mark Paluch + * @since 2.1.0 */ @Configuration @ConditionalOnClass({ ReactiveRedisConnectionFactory.class, Flux.class }) @ConditionalOnBean(ReactiveRedisConnectionFactory.class) -class RedisReactiveHealthIndicatorConfiguration extends +@ConditionalOnEnabledHealthIndicator("redis") +@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class) +@AutoConfigureAfter(RedisReactiveAutoConfiguration.class) +public class RedisReactiveHealthIndicatorAutoConfiguration extends CompositeReactiveHealthIndicatorConfiguration { private final Map redisConnectionFactories; - RedisReactiveHealthIndicatorConfiguration( + RedisReactiveHealthIndicatorAutoConfiguration( Map redisConnectionFactories) { this.redisConnectionFactories = redisConnectionFactories; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/spring.factories b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/spring.factories index 7ce0481fac..8539667910 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/spring.factories +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/spring.factories @@ -5,13 +5,16 @@ org.springframework.boot.actuate.autoconfigure.audit.AuditEventsEndpointAutoConf org.springframework.boot.actuate.autoconfigure.beans.BeansEndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.cache.CachesEndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.cassandra.CassandraHealthIndicatorAutoConfiguration,\ +org.springframework.boot.actuate.autoconfigure.cassandra.CassandraReactiveHealthIndicatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet.CloudFoundryActuatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive.ReactiveCloudFoundryActuatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationPropertiesReportEndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.context.ShutdownEndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.couchbase.CouchbaseHealthIndicatorAutoConfiguration,\ -org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchHealthIndicatorAutoConfiguration,\ +org.springframework.boot.actuate.autoconfigure.couchbase.CouchbaseReactiveHealthIndicatorAutoConfiguration,\ +org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticSearchClientHealthIndicatorAutoConfiguration,\ +org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticSearchJestHealthIndicatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration,\ @@ -64,8 +67,10 @@ org.springframework.boot.actuate.autoconfigure.metrics.web.reactive.WebFluxMetri org.springframework.boot.actuate.autoconfigure.metrics.web.servlet.WebMvcMetricsAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat.TomcatMetricsAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.mongo.MongoHealthIndicatorAutoConfiguration,\ +org.springframework.boot.actuate.autoconfigure.mongo.MongoReactiveHealthIndicatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.neo4j.Neo4jHealthIndicatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.redis.RedisHealthIndicatorAutoConfiguration,\ +org.springframework.boot.actuate.autoconfigure.redis.RedisReactiveHealthIndicatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.scheduling.ScheduledTasksEndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration,\ diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfigurationTests.java similarity index 87% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfigurationTests.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfigurationTests.java index cc3cb35f7a..ceb8883bba 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraReactiveHealthIndicatorAutoConfigurationTests.java @@ -32,17 +32,18 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; /** - * Tests for {@link CassandraReactiveHealthIndicatorConfiguration}. + * Tests for {@link CassandraReactiveHealthIndicatorAutoConfiguration}. * * @author Artsiom Yudovin * @author Stephane Nicoll */ -public class CassandraReactiveHealthIndicatorConfigurationTests { +public class CassandraReactiveHealthIndicatorAutoConfigurationTests { private ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withUserConfiguration(CassandraMockConfiguration.class).withConfiguration( - AutoConfigurations.of(CassandraHealthIndicatorAutoConfiguration.class, - HealthIndicatorAutoConfiguration.class)); + .withUserConfiguration(CassandraMockConfiguration.class) + .withConfiguration(AutoConfigurations.of( + CassandraReactiveHealthIndicatorAutoConfiguration.class, + HealthIndicatorAutoConfiguration.class)); @Test public void runShouldCreateIndicator() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfigurationTests.java similarity index 96% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorConfigurationTests.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfigurationTests.java index b8ca7c46d0..19ae1f8490 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfigurationTests.java @@ -32,12 +32,12 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; /** - * Tests for {@link CouchbaseHealthIndicatorConfiguration}. + * Tests for {@link CouchbaseHealthIndicatorAutoConfiguration}. * * @author Phillip Webb * @author Stephane Nicoll */ -public class CouchbaseHealthIndicatorConfigurationTests { +public class CouchbaseHealthIndicatorAutoConfigurationTests { private ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(CouchbaseMockConfiguration.class).withConfiguration( diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfigurationTests.java similarity index 88% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfigurationTests.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfigurationTests.java index 33385c7f8c..e558f32d4a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseReactiveHealthIndicatorAutoConfigurationTests.java @@ -33,16 +33,17 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; /** - * Tests for {@link CouchbaseReactiveHealthIndicatorConfiguration}. + * Tests for {@link CouchbaseReactiveHealthIndicatorAutoConfiguration}. * * @author Mikalai Lushchytski */ -public class CouchbaseReactiveHealthIndicatorConfigurationTests { +public class CouchbaseReactiveHealthIndicatorAutoConfigurationTests { private ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withUserConfiguration(CouchbaseMockConfiguration.class).withConfiguration( - AutoConfigurations.of(CouchbaseHealthIndicatorAutoConfiguration.class, - HealthIndicatorAutoConfiguration.class)); + .withUserConfiguration(CouchbaseMockConfiguration.class) + .withConfiguration(AutoConfigurations.of( + CouchbaseReactiveHealthIndicatorAutoConfiguration.class, + HealthIndicatorAutoConfiguration.class)); @Test public void runShouldCreateIndicator() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfigurationTests.java index 52ebfa2389..eecd7b8f10 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfigurationTests.java @@ -35,7 +35,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; /** - * Tests for {@link ElasticsearchHealthIndicatorAutoConfiguration}. + * Tests for {@link ElasticSearchClientHealthIndicatorAutoConfiguration} and + * {@link ElasticSearchJestHealthIndicatorAutoConfiguration}. * * @author Phillip Webb */ @@ -43,7 +44,8 @@ public class ElasticsearchHealthIndicatorAutoConfigurationTests { private ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(ElasticsearchAutoConfiguration.class, - ElasticsearchHealthIndicatorAutoConfiguration.class, + ElasticSearchClientHealthIndicatorAutoConfiguration.class, + ElasticSearchJestHealthIndicatorAutoConfiguration.class, HealthIndicatorAutoConfiguration.class)); @Test diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfigurationTests.java similarity index 93% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfigurationTests.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfigurationTests.java index 42e14a06e8..985eb693bc 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoReactiveHealthIndicatorAutoConfigurationTests.java @@ -32,18 +32,18 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link MongoReactiveHealthIndicatorConfiguration}. + * Tests for {@link MongoReactiveHealthIndicatorAutoConfiguration}. * * @author Yulin Qin */ -public class MongoReactiveHealthIndicatorConfigurationTests { +public class MongoReactiveHealthIndicatorAutoConfigurationTests { private ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class, MongoDataAutoConfiguration.class, MongoReactiveAutoConfiguration.class, MongoReactiveDataAutoConfiguration.class, - MongoHealthIndicatorAutoConfiguration.class, + MongoReactiveHealthIndicatorAutoConfiguration.class, HealthIndicatorAutoConfiguration.class)); @Test diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfigurationTests.java similarity index 88% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfigurationTests.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfigurationTests.java index 7a350dfc9c..ef276981a4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorAutoConfigurationTests.java @@ -29,21 +29,21 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link RedisReactiveHealthIndicatorConfiguration}. + * Tests for {@link RedisReactiveHealthIndicatorAutoConfiguration}. * * @author Phillip Webb */ -public class RedisReactiveHealthIndicatorConfigurationTests { +public class RedisReactiveHealthIndicatorAutoConfigurationTests { private ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class, - RedisHealthIndicatorAutoConfiguration.class, + RedisReactiveHealthIndicatorAutoConfiguration.class, HealthIndicatorAutoConfiguration.class)); @Test public void runShouldCreateIndicator() { this.contextRunner.run((context) -> assertThat(context) - .hasSingleBean(RedisReactiveHealthIndicatorConfiguration.class) + .hasSingleBean(RedisReactiveHealthIndicatorAutoConfiguration.class) .doesNotHaveBean(RedisHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } diff --git a/spring-boot-samples/spring-boot-sample-actuator/pom.xml b/spring-boot-samples/spring-boot-sample-actuator/pom.xml index e5d1def429..bda788555b 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/pom.xml +++ b/spring-boot-samples/spring-boot-sample-actuator/pom.xml @@ -24,25 +24,7 @@ org.springframework.boot spring-boot-starter-web - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.boot - spring-boot-starter-jdbc - - - - org.apache.httpcomponents - httpclient - runtime - - - com.h2database - h2 - runtime - + org.springframework.boot diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java index f0487ae34e..8b6243fc04 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java @@ -28,8 +28,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; @@ -42,7 +40,6 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @SpringBootTest(classes = { - ShutdownSampleActuatorApplicationTests.SecurityConfiguration.class, SampleActuatorApplication.class }, webEnvironment = WebEnvironment.RANDOM_PORT) public class ShutdownSampleActuatorApplicationTests { @@ -77,14 +74,6 @@ public class ShutdownSampleActuatorApplicationTests { return "password"; } - @Configuration - static class SecurityConfiguration extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.csrf().disable(); - } - - } + }