From b8de1186e93cdb94628d22d6186c5bce088ce9d7 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 Issue: 46099 --- .../HazelcastHealthContributorAutoConfiguration.java | 4 ++-- ...astHealthContributorAutoConfigurationIntegrationTests.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 | 4 ++-- .../actuate/health}/HazelcastHealthIndicatorTests.java | 2 +- 8 files changed, 13 insertions(+), 11 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 (86%) 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 b4fdaeca40a..17cb899c9e7 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 e4b03e5d041..a3bf02353bc 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 e9933d31b0a..56fe786c162 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 ca18d76cbcb..8df8e50bda5 100644 --- a/spring-boot-project/spring-boot-actuator/build.gradle +++ b/spring-boot-project/spring-boot-actuator/build.gradle @@ -57,7 +57,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") @@ -111,7 +110,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 dc1e355106c..2a2fde8bad4 100644 --- a/spring-boot-project/spring-boot-hazelcast/build.gradle +++ b/spring-boot-project/spring-boot-hazelcast/build.gradle @@ -29,11 +29,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 4cc113df4f8..c75242a258a 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 86% 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 a2c785b0afe..f95df17fddb 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 @@ -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 12e6392b07a..f7070ba948f 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;