Move code from spring-boot-actuator to spring-boot-data-redis

This commit is contained in:
Andy Wilkinson
2025-05-09 15:19:52 +01:00
committed by Phillip Webb
parent 631653cd1d
commit ee458e1909
12 changed files with 33 additions and 30 deletions

View File

@@ -19,13 +19,13 @@ package org.springframework.boot.actuate.autoconfigure.data.redis;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.health.HealthContributor;
import org.springframework.boot.autoconfigure.AutoConfiguration;
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.data.redis.actuate.health.RedisHealthIndicator;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
@@ -40,7 +40,7 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
*/
@AutoConfiguration(after = RedisReactiveHealthContributorAutoConfiguration.class,
afterName = "org.springframework.boot.data.redis.autoconfigure.RedisAutoConfiguration")
@ConditionalOnClass(RedisConnectionFactory.class)
@ConditionalOnClass({ RedisConnectionFactory.class, RedisHealthIndicator.class })
@ConditionalOnBean(RedisConnectionFactory.class)
@ConditionalOnEnabledHealthIndicator("redis")
public class RedisHealthContributorAutoConfiguration

View File

@@ -21,13 +21,13 @@ import reactor.core.publisher.Flux;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthContributor;
import org.springframework.boot.autoconfigure.AutoConfiguration;
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.data.redis.actuate.health.RedisReactiveHealthIndicator;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
@@ -42,7 +42,7 @@ import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
* @since 2.1.0
*/
@AutoConfiguration(afterName = "org.springframework.boot.data.redis.autoconfigure.RedisReactiveAutoConfiguration")
@ConditionalOnClass({ ReactiveRedisConnectionFactory.class, Flux.class })
@ConditionalOnClass({ ReactiveRedisConnectionFactory.class, Flux.class, RedisReactiveHealthIndicator.class })
@ConditionalOnBean(ReactiveRedisConnectionFactory.class)
@ConditionalOnEnabledHealthIndicator("redis")
public class RedisReactiveHealthContributorAutoConfiguration extends

View File

@@ -19,9 +19,9 @@ package org.springframework.boot.actuate.autoconfigure.data.redis;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.data.redis.actuate.health.RedisHealthIndicator;
import org.springframework.boot.data.redis.actuate.health.RedisReactiveHealthIndicator;
import org.springframework.boot.data.redis.autoconfigure.RedisAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;

View File

@@ -19,9 +19,9 @@ package org.springframework.boot.actuate.autoconfigure.data.redis;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.data.redis.actuate.health.RedisHealthIndicator;
import org.springframework.boot.data.redis.actuate.health.RedisReactiveHealthIndicator;
import org.springframework.boot.data.redis.autoconfigure.RedisAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

View File

@@ -12,11 +12,10 @@ description = "Spring Boot Actuator"
dependencies {
api(project(":spring-boot-project:spring-boot"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-autoconfigure-all"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-autoconfigure"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-neo4j"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-test"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"))
dockerTestImplementation("com.redis:testcontainers-redis")
dockerTestImplementation("org.assertj:assertj-core")
dockerTestImplementation("org.junit.jupiter:junit-jupiter")
dockerTestImplementation("org.springframework:spring-test")
@@ -25,7 +24,6 @@ dependencies {
dockerTestImplementation("org.testcontainers:testcontainers")
optional(project(":spring-boot-project:spring-boot-activemq"))
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"))
optional(project(":spring-boot-project:spring-boot-integration"))
@@ -73,6 +71,7 @@ dependencies {
}
optional("org.neo4j.driver:neo4j-java-driver")
optional("org.quartz-scheduler:quartz")
optional("org.springframework:spring-context-support")
optional("org.springframework:spring-jdbc")
optional("org.springframework:spring-messaging")
optional("org.springframework:spring-webflux")
@@ -80,7 +79,6 @@ dependencies {
optional("org.springframework:spring-webmvc")
optional("org.springframework.graphql:spring-graphql")
optional("org.springframework.data:spring-data-ldap")
optional("org.springframework.data:spring-data-redis")
optional("org.springframework.data:spring-data-rest-webmvc")
optional("org.springframework.security:spring-security-core")
optional("org.springframework.security:spring-security-web")
@@ -97,7 +95,7 @@ dependencies {
testFixturesImplementation(project(":spring-boot-project:spring-boot-webflux"))
testFixturesImplementation(project(":spring-boot-project:spring-boot-webmvc"))
testImplementation(project(":spring-boot-project:spring-boot-autoconfigure-all"))
testImplementation(project(":spring-boot-project:spring-boot-autoconfigure"))
testImplementation(project(":spring-boot-project:spring-boot-hazelcast"))
testImplementation(project(":spring-boot-project:spring-boot-jackson"))
testImplementation(project(":spring-boot-project:spring-boot-jersey"))
@@ -105,13 +103,13 @@ dependencies {
testImplementation(project(":spring-boot-project:spring-boot-reactor-netty"))
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation("com.squareup.okhttp3:mockwebserver")
testImplementation("io.micrometer:micrometer-observation-test")
testImplementation("io.projectreactor:reactor-test")
testImplementation("io.r2dbc:r2dbc-h2")
testImplementation("net.minidev:json-smart")
testImplementation("org.apache.logging.log4j:log4j-to-slf4j")
testImplementation("org.glassfish.jersey.media:jersey-media-json-jackson")
testImplementation("com.squareup.okhttp3:mockwebserver")
testRuntimeOnly(project(":spring-boot-project:spring-boot-http-codec"))
testRuntimeOnly("ch.qos.logback:logback-classic")

View File

@@ -14,8 +14,12 @@ dependencies {
api("io.lettuce:lettuce-core")
api("org.springframework.data:spring-data-redis")
compileOnly("com.fasterxml.jackson.core:jackson-annotations")
implementation(project(":spring-boot-project:spring-boot-netty"))
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-actuator"))
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional("redis.clients:jedis")
@@ -27,8 +31,11 @@ dependencies {
dockerTestImplementation("org.junit.jupiter:junit-jupiter")
dockerTestImplementation("org.testcontainers:junit-jupiter")
testCompileOnly("com.fasterxml.jackson.core:jackson-annotations")
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

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 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.data.redis;
package org.springframework.boot.data.redis.actuate.health;
import java.util.Properties;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.data.redis;
package org.springframework.boot.data.redis.actuate.health;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
@@ -32,7 +32,7 @@ import org.springframework.util.Assert;
* @author Christian Dupuis
* @author Richard Santana
* @author Scott Frederick
* @since 2.0.0
* @since 4.0.0
*/
public class RedisHealthIndicator extends AbstractHealthIndicator {

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.data.redis;
package org.springframework.boot.data.redis.actuate.health;
import java.util.Properties;
@@ -36,7 +36,7 @@ import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
* @author Mark Paluch
* @author Artsiom Yudovin
* @author Scott Frederick
* @since 2.0.0
* @since 4.0.0
*/
public class RedisReactiveHealthIndicator extends AbstractReactiveHealthIndicator {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 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 Redis dependent on Spring Data.
* Redis health integration using Spring Data Redis.
*/
package org.springframework.boot.actuate.data.redis;
package org.springframework.boot.data.redis.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.redis;
package org.springframework.boot.data.redis.actuate.health;
import java.util.Arrays;
import java.util.List;
@@ -22,7 +22,6 @@ import java.util.Properties;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status;
import org.springframework.data.redis.RedisConnectionFailureException;

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.redis;
package org.springframework.boot.data.redis.actuate.health;
import java.time.Duration;
import java.util.Properties;
@@ -24,7 +24,6 @@ import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status;
import org.springframework.data.redis.RedisConnectionFailureException;