Create spring-boot-hazelcast module

This commit is contained in:
Stéphane Nicoll 2025-03-21 16:27:03 +01:00 committed by Phillip Webb
parent 67940145bd
commit 087c8aa44b
52 changed files with 132 additions and 106 deletions

View File

@ -56,6 +56,7 @@ include "spring-boot-project:spring-boot-elasticsearch"
include "spring-boot-project:spring-boot-flyway"
include "spring-boot-project:spring-boot-freemarker"
include "spring-boot-project:spring-boot-groovy-templates"
include "spring-boot-project:spring-boot-hazelcast"
include "spring-boot-project:spring-boot-integration"
include "spring-boot-project:spring-boot-jackson"
include "spring-boot-project:spring-boot-jdbc"

View File

@ -23,6 +23,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-data-jpa"))
optional(project(":spring-boot-project:spring-boot-elasticsearch"))
optional(project(":spring-boot-project:spring-boot-flyway"))
optional(project(":spring-boot-project:spring-boot-hazelcast"))
optional(project(":spring-boot-project:spring-boot-integration"))
optional(project(":spring-boot-project:spring-boot-jackson"))
optional(project(":spring-boot-project:spring-boot-jdbc"))
@ -42,7 +43,6 @@ dependencies {
}
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
optional("com.github.ben-manes.caffeine:caffeine")
optional("com.hazelcast:hazelcast")
optional("com.hazelcast:hazelcast-spring")
optional("com.zaxxer:HikariCP")
optional("io.lettuce:lettuce-core")

View File

@ -28,7 +28,7 @@ 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.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;
import org.springframework.context.annotation.Bean;
/**

View File

@ -24,7 +24,7 @@ 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.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.testsupport.classpath.resources.WithResource;

View File

@ -21,7 +21,7 @@ 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.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.testsupport.classpath.resources.WithResource;

View File

@ -34,11 +34,11 @@ import org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoCo
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration;
import org.springframework.boot.context.annotation.UserConfigurations;
import org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;
import org.springframework.boot.liquibase.autoconfigure.LiquibaseAutoConfiguration;
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;

View File

@ -40,7 +40,6 @@ dependencies {
optional("com.fasterxml.jackson.core:jackson-databind")
optional("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
optional("com.github.ben-manes.caffeine:caffeine")
optional("com.hazelcast:hazelcast")
optional("com.hazelcast:hazelcast-spring")
optional("com.zaxxer:HikariCP")
optional("io.lettuce:lettuce-core")
@ -100,6 +99,7 @@ dependencies {
optional("org.springframework.session:spring-session-core")
testImplementation(project(":spring-boot-project:spring-boot-autoconfigure-all"))
testImplementation(project(":spring-boot-project:spring-boot-hazelcast"))
testImplementation(project(":spring-boot-project:spring-boot-jackson"))
testImplementation(project(":spring-boot-project:spring-boot-jsonb"))
testImplementation(project(":spring-boot-project:spring-boot-reactor-netty"))

View File

@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.testsupport.classpath.resources.WithResource;

View File

@ -46,6 +46,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-data-jpa"))
optional(project(":spring-boot-project:spring-boot-elasticsearch"))
optional(project(":spring-boot-project:spring-boot-flyway"))
optional(project(":spring-boot-project:spring-boot-hazelcast"))
optional(project(":spring-boot-project:spring-boot-jackson"))
optional(project(":spring-boot-project:spring-boot-jdbc"))
optional(project(":spring-boot-project:spring-boot-jsonb"))
@ -66,7 +67,6 @@ dependencies {
optional("com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations")
optional("com.fasterxml.jackson.module:jackson-module-parameter-names")
optional("com.google.code.gson:gson")
optional("com.hazelcast:hazelcast")
optional("com.hazelcast:hazelcast-spring")
optional("com.h2database:h2")
optional("com.nimbusds:oauth2-oidc-sdk")

View File

@ -27,7 +27,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.jpa.autoconfigure.EntityManagerFactoryDependsOnPostProcessor;
import org.springframework.cache.CacheManager;
@ -53,10 +52,9 @@ import org.springframework.util.Assert;
* @since 1.3.0
* @see EnableCaching
*/
@AutoConfiguration(
after = { CouchbaseDataAutoConfiguration.class, HazelcastAutoConfiguration.class,
RedisAutoConfiguration.class },
afterName = "org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration")
@AutoConfiguration(after = { CouchbaseDataAutoConfiguration.class, RedisAutoConfiguration.class },
afterName = { "org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration",
"org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration" })
@ConditionalOnClass(CacheManager.class)
@ConditionalOnBean(CacheAspectSupport.class)
@ConditionalOnMissingBean(value = CacheManager.class, name = "cacheResolver")

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.
@ -22,8 +22,8 @@ import com.hazelcast.spring.cache.HazelcastCacheManager;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastConfigResourceCondition;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastConfigResourceCondition;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.
@ -31,7 +31,6 @@ import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfigurat
import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
@ -67,10 +66,11 @@ import org.springframework.session.web.http.HttpSessionIdResolver;
* @since 1.4.0
*/
@AutoConfiguration(
after = { HazelcastAutoConfiguration.class, MongoDataAutoConfiguration.class,
MongoReactiveDataAutoConfiguration.class, RedisAutoConfiguration.class,
RedisReactiveAutoConfiguration.class, WebSessionIdResolverAutoConfiguration.class },
afterName = { "org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration",
after = { MongoDataAutoConfiguration.class, MongoReactiveDataAutoConfiguration.class,
RedisAutoConfiguration.class, RedisReactiveAutoConfiguration.class,
WebSessionIdResolverAutoConfiguration.class },
afterName = { "org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration",
"org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration",
"org.springframework.boot.jdbc.autoconfigure.JdbcTemplateAutoConfiguration" },
before = { HttpHandlerAutoConfiguration.class, WebFluxAutoConfiguration.class })
@ConditionalOnClass(Session.class)

View File

@ -46,8 +46,6 @@ org.springframework.boot.autoconfigure.graphql.servlet.GraphQlWebMvcAutoConfigur
org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration
org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration
org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration
org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration
org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration
org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration
org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration
org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration

View File

@ -49,7 +49,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider;
import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider.MockCacheManager;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.cache.Cache;

View File

@ -2029,6 +2029,7 @@ bom {
"spring-boot-flyway",
"spring-boot-freemarker",
"spring-boot-groovy-templates",
"spring-boot-hazelcast",
"spring-boot-integration",
"spring-boot-jackson",
"spring-boot-jarmode-tools",

View File

@ -17,7 +17,6 @@ dependencies {
dockerTestImplementation(project(":spring-boot-project:spring-boot-pulsar"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-r2dbc"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"))
dockerTestImplementation("com.hazelcast:hazelcast")
dockerTestImplementation("com.redis:testcontainers-redis")
dockerTestImplementation("org.assertj:assertj-core")
dockerTestImplementation("org.awaitility:awaitility")
@ -42,6 +41,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-actuator-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-elasticsearch"))
optional(project(":spring-boot-project:spring-boot-flyway"))
optional(project(":spring-boot-project:spring-boot-hazelcast"))
optional(project(":spring-boot-project:spring-boot-jdbc"))
optional(project(":spring-boot-project:spring-boot-liquibase"))
optional(project(":spring-boot-project:spring-boot-pulsar"))

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.
@ -24,8 +24,8 @@ import com.hazelcast.config.Config;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastConnectionDetails;
import org.springframework.boot.docker.compose.service.connection.test.DockerComposeTest;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastConnectionDetails;
import org.springframework.boot.testsupport.container.TestImage;
import static org.assertj.core.api.Assertions.assertThat;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.
@ -18,10 +18,10 @@ package org.springframework.boot.docker.compose.service.connection.hazelcast;
import com.hazelcast.client.config.ClientConfig;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastConnectionDetails;
import org.springframework.boot.docker.compose.core.RunningService;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionSource;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastConnectionDetails;
/**
* {@link DockerComposeConnectionDetailsFactory} to create

View File

@ -64,6 +64,7 @@ dependencies {
autoConfiguration(project(path: ":spring-boot-project:spring-boot-elasticsearch", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-flyway", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-freemarker", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-integration", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jdbc", configuration: "autoConfigurationMetadata"))
@ -98,6 +99,7 @@ dependencies {
configurationProperties(project(path: ":spring-boot-project:spring-boot-elasticsearch", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-flyway", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-freemarker", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-integration", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-jdbc", configuration: "configurationPropertiesMetadata"))

View File

@ -0,0 +1,25 @@
plugins {
id "java-library"
id "org.springframework.boot.auto-configuration"
id "org.springframework.boot.configuration-properties"
id "org.springframework.boot.deployed"
id "org.springframework.boot.optional-dependencies"
}
description = "Spring Boot Hazelcast"
dependencies {
api(project(":spring-boot-project:spring-boot"))
api("com.hazelcast:hazelcast")
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")
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testRuntimeOnly("com.h2database:h2")
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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import com.hazelcast.core.HazelcastInstance;
@ -31,7 +31,7 @@ import org.springframework.context.annotation.Import;
*
* @author Stephane Nicoll
* @author Vedran Pavic
* @since 1.3.0
* @since 4.0.0
* @see HazelcastConfigResourceCondition
*/
@AutoConfiguration

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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import java.io.IOException;
import java.io.InputStream;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.core.HazelcastInstance;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;

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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import com.hazelcast.config.Config;
@ -24,7 +24,7 @@ import com.hazelcast.config.Config;
*
* @author Jaromir Hamala
* @author Stephane Nicoll
* @since 2.7.0
* @since 4.0.0
*/
@FunctionalInterface
public interface HazelcastConfigCustomizer {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.ResourceCondition;
@ -31,7 +31,7 @@ import org.springframework.util.Assert;
* @author Stephane Nicoll
* @author Madhura Bhave
* @author Vedran Pavic
* @since 1.3.0
* @since 4.0.0
*/
public abstract class HazelcastConfigResourceCondition extends ResourceCondition {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import com.hazelcast.client.config.ClientConfig;
@ -24,7 +24,7 @@ import org.springframework.boot.autoconfigure.service.connection.ConnectionDetai
* Details required to establish a client connection to a Hazelcast instance.
*
* @author Dmytro Nosan
* @since 3.4.0
* @since 4.0.0
*/
public interface HazelcastConnectionDetails extends ConnectionDetails {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import com.hazelcast.client.config.ClientConfig;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import com.hazelcast.core.HazelcastInstance;
import jakarta.persistence.EntityManagerFactory;
@ -23,7 +23,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.AllNestedConditions;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration.HazelcastInstanceEntityManagerFactoryDependsOnConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastJpaDependencyAutoConfiguration.HazelcastInstanceEntityManagerFactoryDependsOnConfiguration;
import org.springframework.boot.jpa.autoconfigure.EntityManagerFactoryDependsOnPostProcessor;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@ -36,7 +36,7 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
* the {@code hazelcastInstance} bean.
*
* @author Stephane Nicoll
* @since 1.3.2
* @since 4.0.0
*/
@AutoConfiguration(after = HazelcastAutoConfiguration.class,
afterName = "org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration")

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.io.Resource;
@ -24,7 +24,7 @@ import org.springframework.util.Assert;
* Configuration properties for the hazelcast integration.
*
* @author Stephane Nicoll
* @since 1.3.0
* @since 4.0.0
*/
@ConfigurationProperties("spring.hazelcast")
public class HazelcastProperties {

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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import java.io.IOException;
import java.io.InputStream;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import java.io.IOException;
import java.io.UncheckedIOException;

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.
@ -17,4 +17,4 @@
/**
* Auto-configuration for Hazelcast.
*/
package org.springframework.boot.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;

View File

@ -0,0 +1,2 @@
org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration
org.springframework.boot.hazelcast.autoconfigure.HazelcastJpaDependencyAutoConfiguration

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import java.io.File;
import java.io.FileReader;
@ -87,7 +87,7 @@ class HazelcastAutoConfigurationClientTests {
@Test
void systemPropertyWithXml() {
File config = prepareConfiguration("src/test/resources/org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-client-specific.xml");
+ "boot/hazelcast/autoconfigure/hazelcast-client-specific.xml");
this.contextRunner
.withSystemProperties(HazelcastClientConfiguration.CONFIG_SYSTEM_PROPERTY + "=" + config.getAbsolutePath())
.run(assertSpecificHazelcastClient("explicit-xml"));
@ -96,7 +96,7 @@ class HazelcastAutoConfigurationClientTests {
@Test
void systemPropertyWithYaml() {
File config = prepareConfiguration("src/test/resources/org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-client-specific.yaml");
+ "boot/hazelcast/autoconfigure/hazelcast-client-specific.yaml");
this.contextRunner
.withSystemProperties(HazelcastClientConfiguration.CONFIG_SYSTEM_PROPERTY + "=" + config.getAbsolutePath())
.run(assertSpecificHazelcastClient("explicit-yaml"));
@ -105,7 +105,7 @@ class HazelcastAutoConfigurationClientTests {
@Test
void systemPropertyWithYml() {
File config = prepareConfiguration("src/test/resources/org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-client-specific.yml");
+ "boot/hazelcast/autoconfigure/hazelcast-client-specific.yml");
this.contextRunner
.withSystemProperties(HazelcastClientConfiguration.CONFIG_SYSTEM_PROPERTY + "=" + config.getAbsolutePath())
.run(assertSpecificHazelcastClient("explicit-yml"));
@ -114,7 +114,7 @@ class HazelcastAutoConfigurationClientTests {
@Test
void explicitConfigUrlWithXml() throws MalformedURLException {
File config = prepareConfiguration("src/test/resources/org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-client-specific.xml");
+ "boot/hazelcast/autoconfigure/hazelcast-client-specific.xml");
this.contextRunner.withPropertyValues("spring.hazelcast.config=" + config.toURI().toURL())
.run(assertSpecificHazelcastClient("explicit-xml"));
}
@ -122,7 +122,7 @@ class HazelcastAutoConfigurationClientTests {
@Test
void explicitConfigUrlWithYaml() throws MalformedURLException {
File config = prepareConfiguration("src/test/resources/org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-client-specific.yaml");
+ "boot/hazelcast/autoconfigure/hazelcast-client-specific.yaml");
this.contextRunner.withPropertyValues("spring.hazelcast.config=" + config.toURI().toURL())
.run(assertSpecificHazelcastClient("explicit-yaml"));
}
@ -130,7 +130,7 @@ class HazelcastAutoConfigurationClientTests {
@Test
void explicitConfigUrlWithYml() throws MalformedURLException {
File config = prepareConfiguration("src/test/resources/org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-client-specific.yml");
+ "boot/hazelcast/autoconfigure/hazelcast-client-specific.yml");
this.contextRunner.withPropertyValues("spring.hazelcast.config=" + config.toURI().toURL())
.run(assertSpecificHazelcastClient("explicit-yml"));
}
@ -170,7 +170,7 @@ class HazelcastAutoConfigurationClientTests {
void clientConfigWithInstanceNameCreatesClientIfNecessary() throws MalformedURLException {
assertThat(HazelcastClient.getHazelcastClientByName("spring-boot")).isNull();
File config = prepareConfiguration("src/test/resources/org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-client-instance.xml");
+ "boot/hazelcast/autoconfigure/hazelcast-client-instance.xml");
this.contextRunner.withPropertyValues("spring.hazelcast.config=" + config.toURI().toURL())
.run((context) -> assertThat(context).getBean(HazelcastInstance.class)
.extracting(HazelcastInstance::getName)
@ -180,7 +180,7 @@ class HazelcastAutoConfigurationClientTests {
@Test
void autoConfiguredClientConfigUsesApplicationClassLoader() throws MalformedURLException {
File config = prepareConfiguration("src/test/resources/org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-client-specific.xml");
+ "boot/hazelcast/autoconfigure/hazelcast-client-specific.xml");
this.contextRunner.withPropertyValues("spring.hazelcast.config=" + config.toURI().toURL()).run((context) -> {
HazelcastInstance hazelcast = context.getBean(HazelcastInstance.class);
assertThat(hazelcast).isInstanceOf(HazelcastClientProxy.class);

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@ -73,7 +73,7 @@ class HazelcastAutoConfigurationServerTests {
void systemPropertyWithXml() {
this.contextRunner
.withSystemProperties(HazelcastServerConfiguration.CONFIG_SYSTEM_PROPERTY
+ "=classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml")
+ "=classpath:org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.xml")
.run((context) -> {
Config config = context.getBean(HazelcastInstance.class).getConfig();
assertThat(config.getMapConfigs().keySet()).containsOnly("foobar");
@ -84,7 +84,7 @@ class HazelcastAutoConfigurationServerTests {
void systemPropertyWithYaml() {
this.contextRunner
.withSystemProperties(HazelcastServerConfiguration.CONFIG_SYSTEM_PROPERTY
+ "=classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yaml")
+ "=classpath:org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.yaml")
.run((context) -> {
Config config = context.getBean(HazelcastInstance.class).getConfig();
assertThat(config.getMapConfigs().keySet()).containsOnly("foobar");
@ -95,7 +95,7 @@ class HazelcastAutoConfigurationServerTests {
void systemPropertyWithYml() {
this.contextRunner
.withSystemProperties(HazelcastServerConfiguration.CONFIG_SYSTEM_PROPERTY
+ "=classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yml")
+ "=classpath:org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.yml")
.run((context) -> {
Config config = context.getBean(HazelcastInstance.class).getConfig();
assertThat(config.getMapConfigs().keySet()).containsOnly("foobar");
@ -105,55 +105,55 @@ class HazelcastAutoConfigurationServerTests {
@Test
void explicitConfigFileWithXml() {
this.contextRunner
.withPropertyValues("spring.hazelcast.config=org/springframework/boot/autoconfigure/hazelcast/"
.withPropertyValues("spring.hazelcast.config=org/springframework/boot/hazelcast/autoconfigure/"
+ "hazelcast-specific.xml")
.run(assertSpecificHazelcastServer(
"org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"));
"org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.xml"));
}
@Test
void explicitConfigFileWithYaml() {
this.contextRunner
.withPropertyValues("spring.hazelcast.config=org/springframework/boot/autoconfigure/hazelcast/"
.withPropertyValues("spring.hazelcast.config=org/springframework/boot/hazelcast/autoconfigure/"
+ "hazelcast-specific.yaml")
.run(assertSpecificHazelcastServer(
"org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yaml"));
"org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.yaml"));
}
@Test
void explicitConfigFileWithYml() {
this.contextRunner
.withPropertyValues("spring.hazelcast.config=org/springframework/boot/autoconfigure/hazelcast/"
.withPropertyValues("spring.hazelcast.config=org/springframework/boot/hazelcast/autoconfigure/"
+ "hazelcast-specific.yml")
.run(assertSpecificHazelcastServer(
"org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yml"));
"org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.yml"));
}
@Test
void explicitConfigUrlWithXml() {
this.contextRunner
.withPropertyValues("spring.hazelcast.config=classpath:org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-specific.xml")
+ "boot/hazelcast/autoconfigure/hazelcast-specific.xml")
.run(assertSpecificHazelcastServer(
"org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"));
"org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.xml"));
}
@Test
void explicitConfigUrlWithYaml() {
this.contextRunner
.withPropertyValues("spring.hazelcast.config=classpath:org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-specific.yaml")
+ "boot/hazelcast/autoconfigure/hazelcast-specific.yaml")
.run(assertSpecificHazelcastServer(
"org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yaml"));
"org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.yaml"));
}
@Test
void explicitConfigUrlWithYml() {
this.contextRunner
.withPropertyValues("spring.hazelcast.config=classpath:org/springframework/"
+ "boot/autoconfigure/hazelcast/hazelcast-specific.yml")
+ "boot/hazelcast/autoconfigure/hazelcast-specific.yml")
.run(assertSpecificHazelcastServer(
"org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yml"));
"org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.yml"));
}
private ContextConsumer<AssertableApplicationContext> assertSpecificHazelcastServer(String location) {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import com.hazelcast.config.Config;
import com.hazelcast.core.HazelcastInstance;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 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.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import org.junit.jupiter.api.Test;
@ -41,7 +41,7 @@ class HazelcastClientConfigAvailableConditionTests {
@Test
void explicitConfigurationWithClientConfigMatches() {
ConditionOutcome outcome = getMatchOutcome(new MockEnvironment().withProperty("spring.hazelcast.config",
"classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-client-specific.xml"));
"classpath:org/springframework/boot/hazelcast/autoconfigure/hazelcast-client-specific.xml"));
assertThat(outcome.isMatch()).isTrue();
assertThat(outcome.getMessage()).contains("Hazelcast client configuration detected");
}
@ -49,7 +49,7 @@ class HazelcastClientConfigAvailableConditionTests {
@Test
void explicitConfigurationWithServerConfigDoesNotMatch() {
ConditionOutcome outcome = getMatchOutcome(new MockEnvironment().withProperty("spring.hazelcast.config",
"classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"));
"classpath:org/springframework/boot/hazelcast/autoconfigure/hazelcast-specific.xml"));
assertThat(outcome.isMatch()).isFalse();
assertThat(outcome.getMessage()).contains("Hazelcast server configuration detected");
}
@ -57,7 +57,7 @@ class HazelcastClientConfigAvailableConditionTests {
@Test
void explicitConfigurationWithMissingConfigDoesNotMatch() {
ConditionOutcome outcome = getMatchOutcome(new MockEnvironment().withProperty("spring.hazelcast.config",
"classpath:org/springframework/boot/autoconfigure/hazelcast/test-config-does-not-exist.xml"));
"classpath:org/springframework/boot/hazelcast/autoconfigure/test-config-does-not-exist.xml"));
assertThat(outcome.isMatch()).isFalse();
assertThat(outcome.getMessage()).contains("Hazelcast configuration does not exist");
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.hazelcast;
package org.springframework.boot.hazelcast.autoconfigure;
import java.util.Arrays;
import java.util.Collections;
@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration.HazelcastInstanceEntityManagerFactoryDependsOnPostProcessor;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastJpaDependencyAutoConfiguration.HazelcastInstanceEntityManagerFactoryDependsOnPostProcessor;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jpa.autoconfigure.EntityManagerFactoryDependsOnPostProcessor;
import org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration;

View File

@ -27,7 +27,6 @@ dependencies {
exclude group: "commons-logging", module: "commons-logging"
}
dockerTestImplementation("com.couchbase.client:java-client")
dockerTestImplementation("com.hazelcast:hazelcast")
dockerTestImplementation("io.micrometer:micrometer-registry-otlp")
dockerTestImplementation("io.rest-assured:rest-assured") {
exclude group: "commons-logging", module: "commons-logging"
@ -65,6 +64,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-actuator-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-elasticsearch"))
optional(project(":spring-boot-project:spring-boot-flyway"))
optional(project(":spring-boot-project:spring-boot-hazelcast"))
optional(project(":spring-boot-project:spring-boot-jdbc"))
optional(project(":spring-boot-project:spring-boot-kafka"))
optional(project(":spring-boot-project:spring-boot-liquibase"))
@ -96,7 +96,6 @@ dependencies {
optional("org.testcontainers:redpanda")
optional("org.testcontainers:r2dbc")
optional("com.redis:testcontainers-redis")
optional("com.hazelcast:hazelcast")
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.
@ -29,8 +29,8 @@ import org.testcontainers.junit.jupiter.Testcontainers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastConnectionDetails;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastConnectionDetails;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.boot.testsupport.container.HazelcastContainer;
import org.springframework.boot.testsupport.container.TestImage;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.
@ -26,8 +26,8 @@ import org.testcontainers.junit.jupiter.Testcontainers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastConnectionDetails;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastConnectionDetails;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.boot.testsupport.container.HazelcastContainer;
import org.springframework.boot.testsupport.container.TestImage;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 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.
@ -22,7 +22,7 @@ import com.hazelcast.client.config.ClientConfig;
import org.testcontainers.containers.Container;
import org.testcontainers.containers.GenericContainer;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastConnectionDetails;
import org.springframework.boot.hazelcast.autoconfigure.HazelcastConnectionDetails;
import org.springframework.boot.testcontainers.service.connection.ContainerConnectionDetailsFactory;
import org.springframework.boot.testcontainers.service.connection.ContainerConnectionSource;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;

View File

@ -39,7 +39,7 @@ dependencies {
ehcache("org.ehcache:ehcache::jakarta")
hazelcast(enforcedPlatform(project(":spring-boot-project:spring-boot-dependencies")))
hazelcast("com.hazelcast:hazelcast")
hazelcast(project(":spring-boot-project:spring-boot-hazelcast"))
hazelcast("com.hazelcast:hazelcast-spring")
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-actuator"))

View File

@ -5,10 +5,10 @@ plugins {
description = "Spring Boot Session smoke test"
dependencies {
implementation(project(":spring-boot-project:spring-boot-hazelcast"))
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-actuator"))
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-security"))
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
implementation("com.hazelcast:hazelcast")
implementation("org.springframework.session:spring-session-hazelcast") {
exclude group: "javax.annotation", module: "javax.annotation-api"
}