Move code from spring-boot-actuator to spring-boot-cassandra

This commit is contained in:
Andy Wilkinson
2025-05-09 10:21:22 +01:00
committed by Phillip Webb
parent adec7f2df2
commit ec0370bc2e
12 changed files with 23 additions and 22 deletions

View File

@@ -20,10 +20,10 @@ import com.datastax.oss.driver.api.core.CqlSession;
import org.springframework.boot.actuate.autoconfigure.cassandra.CassandraHealthContributorConfigurations.CassandraDriverConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.cassandra.CassandraDriverHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.cassandra.actuate.health.CassandraDriverHealthIndicator;
import org.springframework.context.annotation.Import;
/**
@@ -37,7 +37,7 @@ import org.springframework.context.annotation.Import;
@AutoConfiguration(afterName = {
"org.springframework.boot.actuate.autoconfigure.cassandra.CassandraReactiveHealthContributorAutoConfiguration",
"org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration" })
@ConditionalOnClass(CqlSession.class)
@ConditionalOnClass({ CqlSession.class, CassandraDriverHealthIndicator.class })
@ConditionalOnEnabledHealthIndicator("cassandra")
@Import(CassandraDriverConfiguration.class)
public class CassandraHealthContributorAutoConfiguration {

View File

@@ -23,12 +23,12 @@ import com.datastax.oss.driver.api.core.CqlSession;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
import org.springframework.boot.actuate.cassandra.CassandraDriverHealthIndicator;
import org.springframework.boot.actuate.cassandra.CassandraDriverReactiveHealthIndicator;
import org.springframework.boot.actuate.health.HealthContributor;
import org.springframework.boot.actuate.health.ReactiveHealthContributor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.cassandra.actuate.health.CassandraDriverHealthIndicator;
import org.springframework.boot.cassandra.actuate.health.CassandraDriverReactiveHealthIndicator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@@ -21,11 +21,10 @@ import reactor.core.publisher.Flux;
import org.springframework.boot.actuate.autoconfigure.cassandra.CassandraHealthContributorConfigurations.CassandraReactiveDriverConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.cassandra.CassandraDriverReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
import org.springframework.boot.cassandra.actuate.health.CassandraDriverReactiveHealthIndicator;
import org.springframework.context.annotation.Import;
/**
@@ -36,8 +35,8 @@ import org.springframework.context.annotation.Import;
* @author Stephane Nicoll
* @since 2.1.0
*/
@AutoConfiguration(after = CassandraAutoConfiguration.class)
@ConditionalOnClass({ CqlSession.class, Flux.class })
@AutoConfiguration(afterName = "org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration")
@ConditionalOnClass({ CqlSession.class, Flux.class, CassandraDriverReactiveHealthIndicator.class })
@ConditionalOnEnabledHealthIndicator("cassandra")
@Import(CassandraReactiveDriverConfiguration.class)
public class CassandraReactiveHealthContributorAutoConfiguration {

View File

@@ -20,8 +20,8 @@ import com.datastax.oss.driver.api.core.CqlSession;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.cassandra.CassandraDriverHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.cassandra.actuate.health.CassandraDriverHealthIndicator;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -20,8 +20,8 @@ import com.datastax.oss.driver.api.core.CqlSession;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.cassandra.CassandraDriverReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.cassandra.actuate.health.CassandraDriverReactiveHealthIndicator;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -26,7 +26,6 @@ dependencies {
dockerTestImplementation("org.testcontainers:testcontainers")
optional(project(":spring-boot-project:spring-boot-activemq"))
optional(project(":spring-boot-project:spring-boot-data-cassandra"))
optional(project(":spring-boot-project:spring-boot-data-redis"))
optional(project(":spring-boot-project:spring-boot-flyway"))
optional(project(":spring-boot-project:spring-boot-http-converter"))

View File

@@ -13,7 +13,9 @@ dependencies {
api(project(":spring-boot-project:spring-boot"))
api("org.apache.cassandra:java-driver-core")
optional(project(":spring-boot-project:spring-boot-actuator"))
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional("io.projectreactor:reactor-core")
dockerTestImplementation(project(":spring-boot-project:spring-boot-test"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"))
@@ -23,6 +25,7 @@ dependencies {
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation("io.projectreactor:reactor-test")
testRuntimeOnly("ch.qos.logback:logback-classic")
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.cassandra;
package org.springframework.boot.cassandra.actuate.health;
import java.util.Collection;
import java.util.Optional;
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
*
* @author Alexandre Dutra
* @author Tomasz Lelek
* @since 2.4.0
* @since 4.0.0
*/
public class CassandraDriverHealthIndicator extends AbstractHealthIndicator {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.cassandra;
package org.springframework.boot.cassandra.actuate.health;
import java.util.Collection;
import java.util.Optional;
@@ -36,7 +36,7 @@ import org.springframework.util.Assert;
*
* @author Alexandre Dutra
* @author Tomasz Lelek
* @since 2.4.0
* @since 4.0.0
*/
public class CassandraDriverReactiveHealthIndicator extends AbstractReactiveHealthIndicator {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 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.
@@ -15,6 +15,6 @@
*/
/**
* Actuator support for Cassandra.
* Health integration for Cassandra.
*/
package org.springframework.boot.actuate.cassandra;
package org.springframework.boot.cassandra.actuate.health;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.cassandra;
package org.springframework.boot.cassandra.actuate.health;
import java.util.ArrayList;
import java.util.Collections;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.cassandra;
package org.springframework.boot.cassandra.actuate.health;
import java.time.Duration;
import java.util.ArrayList;