From 108ee378ffbdc5b41462e65b1b9d18e83d1ac27d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 9 May 2025 15:51:01 +0100 Subject: [PATCH] Move code from spring-boot-actuator to spring-boot-hazelcast --- .../HazelcastHealthContributorAutoConfiguration.java | 4 ++-- ...tHealthContributorAutoConfigurationIntegrationTests.java | 2 +- .../HazelcastHealthContributorAutoConfigurationTests.java | 2 +- spring-boot-project/spring-boot-actuator/build.gradle | 2 -- spring-boot-project/spring-boot-hazelcast/build.gradle | 4 ++++ .../hazelcast/actuate/health}/HazelcastHealthIndicator.java | 4 ++-- .../boot/hazelcast/actuate/health}/package-info.java | 6 +++--- .../actuate/health}/HazelcastHealthIndicatorTests.java | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/hazelcast => spring-boot-hazelcast/src/main/java/org/springframework/boot/hazelcast/actuate/health}/HazelcastHealthIndicator.java (95%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/hazelcast => spring-boot-hazelcast/src/main/java/org/springframework/boot/hazelcast/actuate/health}/package-info.java (79%) rename spring-boot-project/{spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast => spring-boot-hazelcast/src/test/java/org/springframework/boot/hazelcast/actuate/health}/HazelcastHealthIndicatorTests.java (98%) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfiguration.java index 584f9ea1c6..0c76aaef4d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfiguration.java @@ -21,13 +21,13 @@ import com.hazelcast.core.HazelcastInstance; 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.hazelcast.HazelcastHealthIndicator; 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.hazelcast.actuate.health.HazelcastHealthIndicator; import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration; import org.springframework.context.annotation.Bean; @@ -39,7 +39,7 @@ import org.springframework.context.annotation.Bean; * @since 2.2.0 */ @AutoConfiguration(after = HazelcastAutoConfiguration.class) -@ConditionalOnClass(HazelcastInstance.class) +@ConditionalOnClass({ HazelcastInstance.class, HazelcastHealthIndicator.class }) @ConditionalOnBean(HazelcastInstance.class) @ConditionalOnEnabledHealthIndicator("hazelcast") public class HazelcastHealthContributorAutoConfiguration diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationIntegrationTests.java index 01b9cc4fe8..4926dfccd4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationIntegrationTests.java @@ -20,10 +20,10 @@ import com.hazelcast.core.HazelcastInstance; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; -import org.springframework.boot.actuate.hazelcast.HazelcastHealthIndicator; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Status; import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.hazelcast.actuate.health.HazelcastHealthIndicator; import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.testsupport.classpath.resources.WithResource; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java index 4c76a8a1fb..81418f3484 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java @@ -19,8 +19,8 @@ package org.springframework.boot.actuate.autoconfigure.hazelcast; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; -import org.springframework.boot.actuate.hazelcast.HazelcastHealthIndicator; import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.hazelcast.actuate.health.HazelcastHealthIndicator; import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.testsupport.classpath.resources.WithResource; diff --git a/spring-boot-project/spring-boot-actuator/build.gradle b/spring-boot-project/spring-boot-actuator/build.gradle index 76181f4973..0bf5515a84 100644 --- a/spring-boot-project/spring-boot-actuator/build.gradle +++ b/spring-boot-project/spring-boot-actuator/build.gradle @@ -41,7 +41,6 @@ dependencies { optional("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") optional("com.github.ben-manes.caffeine:caffeine") optional("com.google.code.findbugs:jsr305") - optional("com.hazelcast:hazelcast-spring") optional("com.zaxxer:HikariCP") optional("io.lettuce:lettuce-core") optional("io.micrometer:micrometer-observation") @@ -95,7 +94,6 @@ dependencies { testFixturesImplementation(project(":spring-boot-project:spring-boot-webmvc")) 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")) testImplementation(project(":spring-boot-project:spring-boot-jsonb")) diff --git a/spring-boot-project/spring-boot-hazelcast/build.gradle b/spring-boot-project/spring-boot-hazelcast/build.gradle index 9ff7b30959..324ad30ffe 100644 --- a/spring-boot-project/spring-boot-hazelcast/build.gradle +++ b/spring-boot-project/spring-boot-hazelcast/build.gradle @@ -12,11 +12,15 @@ dependencies { api(project(":spring-boot-project:spring-boot")) api("com.hazelcast:hazelcast") + compileOnly("com.fasterxml.jackson.core:jackson-annotations") + + optional(project(":spring-boot-project:spring-boot-actuator")) optional(project(":spring-boot-project:spring-boot-autoconfigure")) optional(project(":spring-boot-project:spring-boot-jpa")) optional("com.hazelcast:hazelcast-spring") optional("org.slf4j:slf4j-api") + 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")) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicator.java b/spring-boot-project/spring-boot-hazelcast/src/main/java/org/springframework/boot/hazelcast/actuate/health/HazelcastHealthIndicator.java similarity index 95% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicator.java rename to spring-boot-project/spring-boot-hazelcast/src/main/java/org/springframework/boot/hazelcast/actuate/health/HazelcastHealthIndicator.java index 694ebec52a..d5d50fe973 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicator.java +++ b/spring-boot-project/spring-boot-hazelcast/src/main/java/org/springframework/boot/hazelcast/actuate/health/HazelcastHealthIndicator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.hazelcast; +package org.springframework.boot.hazelcast.actuate.health; import com.hazelcast.core.HazelcastInstance; @@ -28,7 +28,7 @@ import org.springframework.util.Assert; * * @author Dmytro Nosan * @author Stephane Nicoll - * @since 2.2.0 + * @since 4.0.0 */ public class HazelcastHealthIndicator extends AbstractHealthIndicator { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/hazelcast/package-info.java b/spring-boot-project/spring-boot-hazelcast/src/main/java/org/springframework/boot/hazelcast/actuate/health/package-info.java similarity index 79% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/hazelcast/package-info.java rename to spring-boot-project/spring-boot-hazelcast/src/main/java/org/springframework/boot/hazelcast/actuate/health/package-info.java index 44e785578d..1a2f619343 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/hazelcast/package-info.java +++ b/spring-boot-project/spring-boot-hazelcast/src/main/java/org/springframework/boot/hazelcast/actuate/health/package-info.java @@ -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 Hazelcast. + * Health integration for Hazelcast. */ -package org.springframework.boot.actuate.hazelcast; +package org.springframework.boot.hazelcast.actuate.health; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java b/spring-boot-project/spring-boot-hazelcast/src/test/java/org/springframework/boot/hazelcast/actuate/health/HazelcastHealthIndicatorTests.java similarity index 98% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java rename to spring-boot-project/spring-boot-hazelcast/src/test/java/org/springframework/boot/hazelcast/actuate/health/HazelcastHealthIndicatorTests.java index 3e29945171..fbf409b170 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-hazelcast/src/test/java/org/springframework/boot/hazelcast/actuate/health/HazelcastHealthIndicatorTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.hazelcast; +package org.springframework.boot.hazelcast.actuate.health; import com.hazelcast.core.HazelcastException; import com.hazelcast.core.HazelcastInstance;