diff --git a/configuration-metadata/spring-boot-configuration-metadata-changelog-generator/build.gradle b/configuration-metadata/spring-boot-configuration-metadata-changelog-generator/build.gradle index 43f1d9513e0..f22a121b6d0 100644 --- a/configuration-metadata/spring-boot-configuration-metadata-changelog-generator/build.gradle +++ b/configuration-metadata/spring-boot-configuration-metadata-changelog-generator/build.gradle @@ -117,7 +117,6 @@ def dependenciesOf(String version) { "spring-boot-servlet", "spring-boot-session", "spring-boot-session-data-redis", - "spring-boot-session-hazelcast", "spring-boot-session-jdbc", "spring-boot-sql", "spring-boot-test-autoconfigure", diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/web/spring-session.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/web/spring-session.adoc index 6d525a5c06f..72fb41bb616 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/web/spring-session.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/web/spring-session.adoc @@ -6,7 +6,6 @@ When building a servlet web application, the following stores can be auto-config * Redis * JDBC -* Hazelcast Additionally, {url-spring-boot-for-apache-geode-site}[Spring Boot for Apache Geode] provides {url-spring-boot-for-apache-geode-docs}#geode-session[auto-configuration for using Apache Geode as a session store]. @@ -17,8 +16,7 @@ If you have more than one implementation, Spring Boot uses the following order f . Redis . JDBC -. Hazelcast -. If none of Redis, JDBC, and Hazelcast are available, we do not configure a javadoc:org.springframework.session.SessionRepository[]. +. If neither Redis or JDBC are available, we do not configure a javadoc:org.springframework.session.SessionRepository[]. When building a reactive web application, the Redis store can be auto-configured. diff --git a/module/spring-boot-autoconfigure-classic-modules/build.gradle b/module/spring-boot-autoconfigure-classic-modules/build.gradle index 4c7554128e8..8d0714ac8fd 100644 --- a/module/spring-boot-autoconfigure-classic-modules/build.gradle +++ b/module/spring-boot-autoconfigure-classic-modules/build.gradle @@ -238,9 +238,6 @@ dependencies { api(project(":module:spring-boot-session-data-redis")) { transitive = false } - api(project(":module:spring-boot-session-hazelcast")) { - transitive = false - } api(project(":module:spring-boot-session-jdbc")) { transitive = false } diff --git a/module/spring-boot-session-hazelcast/build.gradle b/module/spring-boot-session-hazelcast/build.gradle deleted file mode 100644 index 318aa178fe7..00000000000 --- a/module/spring-boot-session-hazelcast/build.gradle +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -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 Session Hazelcast" - -dependencies { - api(project(":core:spring-boot")) - api(project(":module:spring-boot-session")) - api("org.springframework.session:spring-session-hazelcast") - - implementation(project(":module:spring-boot-hazelcast")) - implementation(project(":module:spring-boot-web-server")) - - optional(project(":core:spring-boot-autoconfigure")) - - testImplementation(project(":core:spring-boot-test")) - testImplementation(project(":test-support:spring-boot-test-support")) - testImplementation(testFixtures(project(":module:spring-boot-session"))) - testImplementation("jakarta.servlet:jakarta.servlet-api") - testImplementation("org.springframework:spring-web") - - testRuntimeOnly("ch.qos.logback:logback-classic") -} - -tasks.named("compileTestJava") { - options.nullability.checking = "tests" -} diff --git a/module/spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure/HazelcastSessionAutoConfiguration.java b/module/spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure/HazelcastSessionAutoConfiguration.java deleted file mode 100644 index b5b995d0457..00000000000 --- a/module/spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure/HazelcastSessionAutoConfiguration.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.session.hazelcast.autoconfigure; - -import com.hazelcast.core.HazelcastInstance; - -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.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.context.properties.PropertyMapper; -import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration; -import org.springframework.boot.session.autoconfigure.SessionAutoConfiguration; -import org.springframework.boot.session.autoconfigure.SessionProperties; -import org.springframework.boot.web.server.autoconfigure.ServerProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.session.Session; -import org.springframework.session.SessionRepository; -import org.springframework.session.config.SessionRepositoryCustomizer; -import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository; -import org.springframework.session.hazelcast.config.annotation.web.http.HazelcastHttpSessionConfiguration; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for Spring Session Hazelcast. - * - * @author Tommy Ludwig - * @author EddĂș MelĂ©ndez - * @author Stephane Nicoll - * @author Vedran Pavic - * @since 4.0.0 - */ -@AutoConfiguration(before = SessionAutoConfiguration.class, after = HazelcastAutoConfiguration.class) -@ConditionalOnWebApplication(type = Type.SERVLET) -@ConditionalOnClass({ Session.class, HazelcastIndexedSessionRepository.class }) -@ConditionalOnMissingBean(SessionRepository.class) -@ConditionalOnBean(HazelcastInstance.class) -@EnableConfigurationProperties({ HazelcastSessionProperties.class, ServerProperties.class, SessionProperties.class }) -@Import(HazelcastHttpSessionConfiguration.class) -public final class HazelcastSessionAutoConfiguration { - - @Bean - @Order(Ordered.HIGHEST_PRECEDENCE) - SessionRepositoryCustomizer springBootSessionRepositoryCustomizer( - SessionProperties sessionProperties, HazelcastSessionProperties hazelcastSessionProperties, - ServerProperties serverProperties) { - return (sessionRepository) -> { - PropertyMapper map = PropertyMapper.get(); - map.from(sessionProperties.determineTimeout(() -> serverProperties.getServlet().getSession().getTimeout())) - .to(sessionRepository::setDefaultMaxInactiveInterval); - map.from(hazelcastSessionProperties::getMapName).to(sessionRepository::setSessionMapName); - map.from(hazelcastSessionProperties::getFlushMode).to(sessionRepository::setFlushMode); - map.from(hazelcastSessionProperties::getSaveMode).to(sessionRepository::setSaveMode); - }; - } - -} diff --git a/module/spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure/HazelcastSessionProperties.java b/module/spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure/HazelcastSessionProperties.java deleted file mode 100644 index 2873d2549e4..00000000000 --- a/module/spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure/HazelcastSessionProperties.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.session.hazelcast.autoconfigure; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.session.FlushMode; -import org.springframework.session.SaveMode; - -/** - * Configuration properties for Hazelcast backed Spring Session. - * - * @author Vedran Pavic - * @since 4.0.0 - */ -@ConfigurationProperties("spring.session.hazelcast") -public class HazelcastSessionProperties { - - /** - * Name of the map used to store sessions. - */ - private String mapName = "spring:session:sessions"; - - /** - * Sessions flush mode. Determines when session changes are written to the session - * store. - */ - private FlushMode flushMode = FlushMode.ON_SAVE; - - /** - * Sessions save mode. Determines how session changes are tracked and saved to the - * session store. - */ - private SaveMode saveMode = SaveMode.ON_SET_ATTRIBUTE; - - public String getMapName() { - return this.mapName; - } - - public void setMapName(String mapName) { - this.mapName = mapName; - } - - public FlushMode getFlushMode() { - return this.flushMode; - } - - public void setFlushMode(FlushMode flushMode) { - this.flushMode = flushMode; - } - - public SaveMode getSaveMode() { - return this.saveMode; - } - - public void setSaveMode(SaveMode saveMode) { - this.saveMode = saveMode; - } - -} diff --git a/module/spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure/package-info.java b/module/spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure/package-info.java deleted file mode 100644 index 6cbb59e41ca..00000000000 --- a/module/spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Auto-configuration for Spring Session Hazelcast. - */ -@NullMarked -package org.springframework.boot.session.hazelcast.autoconfigure; - -import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-session-hazelcast/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/module/spring-boot-session-hazelcast/src/main/resources/META-INF/additional-spring-configuration-metadata.json deleted file mode 100644 index 671fd2520c2..00000000000 --- a/module/spring-boot-session-hazelcast/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "groups": [], - "properties": [] -} diff --git a/module/spring-boot-session-hazelcast/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/module/spring-boot-session-hazelcast/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 09d2ab42384..00000000000 --- a/module/spring-boot-session-hazelcast/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -org.springframework.boot.session.hazelcast.autoconfigure.HazelcastSessionAutoConfiguration diff --git a/module/spring-boot-session-hazelcast/src/test/java/org/springframework/boot/session/hazelcast/autoconfigure/HazelcastSessionAutoConfigurationTests.java b/module/spring-boot-session-hazelcast/src/test/java/org/springframework/boot/session/hazelcast/autoconfigure/HazelcastSessionAutoConfigurationTests.java deleted file mode 100644 index 58b5a10d2cd..00000000000 --- a/module/spring-boot-session-hazelcast/src/test/java/org/springframework/boot/session/hazelcast/autoconfigure/HazelcastSessionAutoConfigurationTests.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.session.hazelcast.autoconfigure; - -import java.time.Duration; - -import com.hazelcast.core.HazelcastInstance; -import com.hazelcast.map.IMap; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.session.autoconfigure.AbstractSessionAutoConfigurationTests; -import org.springframework.boot.session.autoconfigure.SessionAutoConfiguration; -import org.springframework.boot.test.context.runner.WebApplicationContextRunner; -import org.springframework.boot.web.server.autoconfigure.ServerProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.session.FlushMode; -import org.springframework.session.SaveMode; -import org.springframework.session.config.SessionRepositoryCustomizer; -import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.Mockito.mock; - -/** - * Tests for {@link HazelcastSessionAutoConfiguration}. - * - * @author Vedran Pavic - */ -class HazelcastSessionAutoConfigurationTests extends AbstractSessionAutoConfigurationTests { - - @BeforeEach - void prepareContextRunner() { - this.contextRunner = new WebApplicationContextRunner() - .withConfiguration( - AutoConfigurations.of(SessionAutoConfiguration.class, HazelcastSessionAutoConfiguration.class)) - .withUserConfiguration(HazelcastConfiguration.class); - } - - @Test - void defaultConfig() { - this.contextRunner.run((context) -> { - HazelcastIndexedSessionRepository repository = validateSessionRepository(context, - HazelcastIndexedSessionRepository.class); - assertThat(repository).hasFieldOrPropertyWithValue("defaultMaxInactiveInterval", - new ServerProperties().getServlet().getSession().getTimeout()); - HazelcastInstance hazelcastInstance = context.getBean(HazelcastInstance.class); - then(hazelcastInstance).should().getMap("spring:session:sessions"); - }); - } - - @Test - void defaultConfigWithCustomTimeout() { - this.contextRunner.withPropertyValues("spring.session.timeout=1m").run((context) -> { - HazelcastIndexedSessionRepository repository = validateSessionRepository(context, - HazelcastIndexedSessionRepository.class); - assertThat(repository).hasFieldOrPropertyWithValue("defaultMaxInactiveInterval", Duration.ofMinutes(1)); - }); - } - - @Test - void customMapName() { - this.contextRunner.withPropertyValues("spring.session.hazelcast.map-name=foo:bar:biz").run((context) -> { - validateSessionRepository(context, HazelcastIndexedSessionRepository.class); - HazelcastInstance hazelcastInstance = context.getBean(HazelcastInstance.class); - then(hazelcastInstance).should().getMap("foo:bar:biz"); - }); - } - - @Test - void customFlushMode() { - this.contextRunner.withPropertyValues("spring.session.hazelcast.flush-mode=immediate").run((context) -> { - HazelcastIndexedSessionRepository repository = validateSessionRepository(context, - HazelcastIndexedSessionRepository.class); - assertThat(repository).hasFieldOrPropertyWithValue("flushMode", FlushMode.IMMEDIATE); - }); - } - - @Test - void customSaveMode() { - this.contextRunner.withPropertyValues("spring.session.hazelcast.save-mode=on-get-attribute").run((context) -> { - HazelcastIndexedSessionRepository repository = validateSessionRepository(context, - HazelcastIndexedSessionRepository.class); - assertThat(repository).hasFieldOrPropertyWithValue("saveMode", SaveMode.ON_GET_ATTRIBUTE); - }); - } - - @Test - void whenTheUserDefinesTheirOwnSessionRepositoryCustomizerThenDefaultConfigurationIsOverwritten() { - this.contextRunner.withUserConfiguration(CustomizerConfiguration.class) - .withPropertyValues("spring.session.hazelcast.save-mode=on-get-attribute") - .run((context) -> { - HazelcastIndexedSessionRepository repository = validateSessionRepository(context, - HazelcastIndexedSessionRepository.class); - assertThat(repository).hasFieldOrPropertyWithValue("saveMode", SaveMode.ALWAYS); - }); - } - - @Configuration(proxyBeanMethods = false) - static class HazelcastConfiguration { - - @Bean - @SuppressWarnings("unchecked") - HazelcastInstance hazelcastInstance() { - IMap map = mock(IMap.class); - HazelcastInstance mock = mock(HazelcastInstance.class); - given(mock.getMap("spring:session:sessions")).willReturn(map); - given(mock.getMap("foo:bar:biz")).willReturn(map); - return mock; - } - - } - - @Configuration(proxyBeanMethods = false) - static class CustomizerConfiguration { - - @Bean - SessionRepositoryCustomizer sessionRepositoryCustomizer() { - return (repository) -> repository.setSaveMode(SaveMode.ALWAYS); - } - - } - -} diff --git a/platform/spring-boot-dependencies/build.gradle b/platform/spring-boot-dependencies/build.gradle index 90a9c626e5b..ef19280b63d 100644 --- a/platform/spring-boot-dependencies/build.gradle +++ b/platform/spring-boot-dependencies/build.gradle @@ -2088,7 +2088,6 @@ bom { "spring-boot-servlet", "spring-boot-session", "spring-boot-session-data-redis", - "spring-boot-session-hazelcast", "spring-boot-session-jdbc", "spring-boot-sql", "spring-boot-starter", @@ -2228,8 +2227,6 @@ bom { "spring-boot-starter-sendgrid-test", "spring-boot-starter-session-data-redis", "spring-boot-starter-session-data-redis-test", - "spring-boot-starter-session-hazelcast", - "spring-boot-starter-session-hazelcast-test", "spring-boot-starter-session-jdbc", "spring-boot-starter-session-jdbc-test", "spring-boot-starter-sql", diff --git a/settings.gradle b/settings.gradle index 39d2eea2329..d946f982216 100644 --- a/settings.gradle +++ b/settings.gradle @@ -178,7 +178,6 @@ include "module:spring-boot-sendgrid" include "module:spring-boot-servlet" include "module:spring-boot-session" include "module:spring-boot-session-data-redis" -include "module:spring-boot-session-hazelcast" include "module:spring-boot-session-jdbc" include "module:spring-boot-sql" include "module:spring-boot-test-classic-modules" @@ -337,8 +336,6 @@ include "starter:spring-boot-starter-sendgrid" include "starter:spring-boot-starter-sendgrid-test" include "starter:spring-boot-starter-session-data-redis" include "starter:spring-boot-starter-session-data-redis-test" -include "starter:spring-boot-starter-session-hazelcast" -include "starter:spring-boot-starter-session-hazelcast-test" include "starter:spring-boot-starter-session-jdbc" include "starter:spring-boot-starter-session-jdbc-test" include "starter:spring-boot-starter-sql" @@ -438,7 +435,6 @@ include ":smoke-test:spring-boot-smoke-test-saml2-service-provider" include ":smoke-test:spring-boot-smoke-test-secure" include ":smoke-test:spring-boot-smoke-test-secure-webflux" include ":smoke-test:spring-boot-smoke-test-servlet" -include ":smoke-test:spring-boot-smoke-test-session-hazelcast" include ":smoke-test:spring-boot-smoke-test-session-jdbc" include ":smoke-test:spring-boot-smoke-test-session-data-redis" include ":smoke-test:spring-boot-smoke-test-session-data-redis-webflux" diff --git a/smoke-test/spring-boot-smoke-test-session-hazelcast/build.gradle b/smoke-test/spring-boot-smoke-test-session-hazelcast/build.gradle deleted file mode 100644 index b3f89142abb..00000000000 --- a/smoke-test/spring-boot-smoke-test-session-hazelcast/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id "java" -} - -description = "Spring Boot Session smoke test" - -dependencies { - implementation(project(":starter:spring-boot-starter-actuator")) - implementation(project(":starter:spring-boot-starter-security")) - implementation(project(":starter:spring-boot-starter-session-hazelcast")) - implementation(project(":starter:spring-boot-starter-webmvc")) - - testImplementation(project(":starter:spring-boot-starter-webmvc-test")) - testImplementation(project(":starter:spring-boot-starter-test")) -} - -tasks.named("compileTestJava") { - options.nullability.checking = "tests" -} diff --git a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/java/smoketest/session/hazelcast/SampleSessionHazelcastApplication.java b/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/java/smoketest/session/hazelcast/SampleSessionHazelcastApplication.java deleted file mode 100644 index c3febdaca8d..00000000000 --- a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/java/smoketest/session/hazelcast/SampleSessionHazelcastApplication.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package smoketest.session.hazelcast; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class SampleSessionHazelcastApplication { - - public static void main(String[] args) { - SpringApplication.run(SampleSessionHazelcastApplication.class); - } - -} diff --git a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/java/smoketest/session/hazelcast/SecurityConfiguration.java b/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/java/smoketest/session/hazelcast/SecurityConfiguration.java deleted file mode 100644 index ff1141117f5..00000000000 --- a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/java/smoketest/session/hazelcast/SecurityConfiguration.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package smoketest.session.hazelcast; - -import org.springframework.boot.health.actuate.endpoint.HealthEndpoint; -import org.springframework.boot.security.autoconfigure.actuate.servlet.EndpointRequest; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configurers.CsrfConfigurer; -import org.springframework.security.web.SecurityFilterChain; - -import static org.springframework.security.config.Customizer.withDefaults; - -/** - * Security configuration. - * - * @author Madhura Bhave - */ -@Configuration(proxyBeanMethods = false) -class SecurityConfiguration { - - @Bean - SecurityFilterChain managementSecurityFilterChain(HttpSecurity http) { - http.authorizeHttpRequests((requests) -> { - requests.requestMatchers(EndpointRequest.to(HealthEndpoint.class)).permitAll(); - requests.anyRequest().authenticated(); - }); - http.formLogin(withDefaults()); - http.httpBasic(withDefaults()); - http.csrf(CsrfConfigurer::disable); - return http.build(); - } - -} diff --git a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/java/smoketest/session/hazelcast/package-info.java b/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/java/smoketest/session/hazelcast/package-info.java deleted file mode 100644 index 67cca1468c3..00000000000 --- a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/java/smoketest/session/hazelcast/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@NullMarked -package smoketest.session.hazelcast; - -import org.jspecify.annotations.NullMarked; diff --git a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/resources/application.properties b/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/resources/application.properties deleted file mode 100644 index ec27160a368..00000000000 --- a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/resources/application.properties +++ /dev/null @@ -1,4 +0,0 @@ -spring.security.user.name=user -spring.security.user.password=password - -management.endpoints.web.exposure.include=* \ No newline at end of file diff --git a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml b/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml deleted file mode 100644 index 064a1b00b9a..00000000000 --- a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - principalName - - - - - - - - - - - diff --git a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/test/java/smoketest/session/hazelcast/SampleSessionHazelcastApplicationTests.java b/smoke-test/spring-boot-smoke-test-session-hazelcast/src/test/java/smoketest/session/hazelcast/SampleSessionHazelcastApplicationTests.java deleted file mode 100644 index 30d7c4aef7f..00000000000 --- a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/test/java/smoketest/session/hazelcast/SampleSessionHazelcastApplicationTests.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package smoketest.session.hazelcast; - -import java.net.URI; -import java.util.Base64; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.resttestclient.TestRestTemplate; -import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.RequestEntity; -import org.springframework.http.ResponseEntity; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link SampleSessionHazelcastApplication}. - * - * @author Susmitha Kandula - * @author Madhura Bhave - */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@AutoConfigureTestRestTemplate -class SampleSessionHazelcastApplicationTests { - - @Autowired - private TestRestTemplate restTemplate; - - @Test - @SuppressWarnings("unchecked") - void sessionsEndpointShouldReturnUserSession() { - performLogin(); - ResponseEntity> entity = getSessions(); - assertThat(entity).isNotNull(); - assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); - Map body = entity.getBody(); - assertThat(body).isNotNull(); - List> sessions = (List>) body.get("sessions"); - assertThat(sessions).hasSize(1); - } - - private void performLogin() { - HttpHeaders headers = new HttpHeaders(); - headers.setAccept(Collections.singletonList(MediaType.TEXT_HTML)); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - MultiValueMap form = new LinkedMultiValueMap<>(); - form.set("username", "user"); - form.set("password", "password"); - this.restTemplate.exchange("/login", HttpMethod.POST, new HttpEntity<>(form, headers), String.class); - } - - private ResponseEntity> getSessions() { - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", getBasicAuth()); - RequestEntity request = new RequestEntity<>(headers, HttpMethod.GET, - URI.create("/actuator/sessions?username=user")); - ParameterizedTypeReference> stringObjectMap = new ParameterizedTypeReference<>() { - }; - return this.restTemplate.exchange(request, stringObjectMap); - } - - private String getBasicAuth() { - return "Basic " + Base64.getEncoder().encodeToString("user:password".getBytes()); - } - -} diff --git a/starter/spring-boot-starter-session-hazelcast-test/build.gradle b/starter/spring-boot-starter-session-hazelcast-test/build.gradle deleted file mode 100644 index fb287292d75..00000000000 --- a/starter/spring-boot-starter-session-hazelcast-test/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id "org.springframework.boot.starter" -} - -description = "Starter for testing Spring Session with Hazelcast" - -dependencies { - api(project(":starter:spring-boot-starter-session-hazelcast")) - api(project(":starter:spring-boot-starter-test")) - api(project(":starter:spring-boot-starter-hazelcast-test")) -} diff --git a/starter/spring-boot-starter-session-hazelcast/build.gradle b/starter/spring-boot-starter-session-hazelcast/build.gradle deleted file mode 100644 index 9ee29c51280..00000000000 --- a/starter/spring-boot-starter-session-hazelcast/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id "org.springframework.boot.starter" -} - -description = "Starter for using Spring Session with Hazelcast" - -dependencies { - api(project(":starter:spring-boot-starter")) - api(project(":starter:spring-boot-starter-hazelcast")) - - api(project(":module:spring-boot-session-hazelcast")) - api(project(":module:spring-boot-hazelcast")) -}