diff --git a/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java b/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java index 2c9f93975..0d0115bbd 100644 --- a/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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. @@ -25,7 +25,6 @@ import jakarta.servlet.http.HttpServletRequest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -39,9 +38,7 @@ import org.springframework.session.web.http.CookieSerializer; import org.springframework.session.web.http.CookieSerializer.CookieValue; import org.springframework.session.web.http.SessionRepositoryFilter; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -57,9 +54,7 @@ * * @author Rob Winch */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class EnableSpringHttpSessionCustomCookieSerializerTests { @Autowired diff --git a/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/AbstractITest.java b/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/AbstractITest.java index 450084b5f..a11f115a3 100644 --- a/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/AbstractITest.java +++ b/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/AbstractITest.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -19,22 +19,19 @@ import java.util.UUID; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Base class for repositories integration tests * * @author Jakub Kubrynski */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration +@SpringJUnitWebConfig public abstract class AbstractITest { protected SecurityContext context; diff --git a/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/MongoDbDeleteJacksonSessionVerificationTest.java b/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/MongoDbDeleteJacksonSessionVerificationTest.java index 930955744..273404e6c 100644 --- a/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/MongoDbDeleteJacksonSessionVerificationTest.java +++ b/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/MongoDbDeleteJacksonSessionVerificationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -23,7 +23,6 @@ import org.assertj.core.api.AssertionsForClassTypes; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.MongoDBContainer; import reactor.test.StepVerifier; @@ -43,8 +42,7 @@ import org.springframework.security.core.userdetails.User; import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.session.data.mongo.config.annotation.web.reactive.EnableMongoWebSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.web.reactive.server.FluxExchangeResult; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.web.bind.annotation.GetMapping; @@ -55,8 +53,7 @@ /** * @author Boris Finkelshteyn */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration +@SpringJUnitConfig class MongoDbDeleteJacksonSessionVerificationTest { @Autowired diff --git a/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/MongoDbLogoutVerificationTest.java b/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/MongoDbLogoutVerificationTest.java index 200495718..15370fe7e 100644 --- a/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/MongoDbLogoutVerificationTest.java +++ b/spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/MongoDbLogoutVerificationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -23,7 +23,6 @@ import org.assertj.core.api.AssertionsForClassTypes; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.MongoDBContainer; import reactor.test.StepVerifier; @@ -43,8 +42,7 @@ import org.springframework.security.core.userdetails.User; import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.session.data.mongo.config.annotation.web.reactive.EnableMongoWebSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.web.reactive.server.FluxExchangeResult; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.web.bind.annotation.GetMapping; @@ -55,8 +53,7 @@ /** * @author Greg Turnquist */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration +@SpringJUnitConfig class MongoDbLogoutVerificationTest { @Autowired diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisIndexedSessionRepositoryConfigurationITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisIndexedSessionRepositoryConfigurationITests.java index 11aa3c959..a36599afb 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisIndexedSessionRepositoryConfigurationITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisIndexedSessionRepositoryConfigurationITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 the original author or authors. + * Copyright 2014-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,7 +24,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -43,13 +42,13 @@ import org.springframework.session.data.redis.config.ConfigureReactiveRedisAction; import org.springframework.session.data.redis.config.annotation.web.server.EnableRedisIndexedWebSession; import org.springframework.session.events.SessionCreatedEvent; -import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; -@ExtendWith(SpringExtension.class) +@SpringJUnitConfig class ReactiveRedisIndexedSessionRepositoryConfigurationITests { ReactiveRedisIndexedSessionRepository repository; diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisIndexedSessionRepositoryITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisIndexedSessionRepositoryITests.java index b59dc533d..6bf6efb80 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisIndexedSessionRepositoryITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 the original author or authors. + * Copyright 2014-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. @@ -23,7 +23,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -43,17 +42,13 @@ import org.springframework.session.events.SessionCreatedEvent; import org.springframework.session.events.SessionDeletedEvent; import org.springframework.session.events.SessionExpiredEvent; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatNoException; import static org.awaitility.Awaitility.await; -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig @SuppressWarnings({ "ConstantConditions" }) class ReactiveRedisIndexedSessionRepositoryITests { diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisSessionRepositoryITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisSessionRepositoryITests.java index f5c9a816f..b0e2751f7 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisSessionRepositoryITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 the original author or authors. + * Copyright 2014-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. @@ -21,7 +21,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; @@ -31,9 +30,7 @@ import org.springframework.session.Session; import org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession; import org.springframework.session.data.redis.config.annotation.web.server.EnableRedisWebSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -51,9 +48,7 @@ * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class ReactiveRedisSessionRepositoryITests extends AbstractRedisITests { @Autowired diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisSessionRepositoryKeyMissITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisSessionRepositoryKeyMissITests.java index d8747c8ba..14588e5e7 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisSessionRepositoryKeyMissITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisSessionRepositoryKeyMissITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 the original author or authors. + * Copyright 2014-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. @@ -21,7 +21,6 @@ import java.util.function.BiFunction; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Mono; import org.springframework.context.annotation.Bean; @@ -32,7 +31,7 @@ import org.springframework.session.config.ReactiveSessionRepositoryCustomizer; import org.springframework.session.data.redis.ReactiveRedisSessionRepository.RedisSession; import org.springframework.session.data.redis.config.annotation.web.server.EnableRedisWebSession; -import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -50,7 +49,7 @@ * @see Related * GitHub Issue */ -@ExtendWith(SpringExtension.class) +@SpringJUnitConfig class ReactiveRedisSessionRepositoryKeyMissITests extends AbstractRedisITests { private ReactiveRedisSessionRepository sessionRepository; diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryDynamicITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryDynamicITests.java index b7247356c..af3c8da76 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryDynamicITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryDynamicITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 the original author or authors. + * Copyright 2014-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. @@ -21,7 +21,6 @@ import java.util.function.BiFunction; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -31,7 +30,7 @@ import org.springframework.session.config.SessionRepositoryCustomizer; import org.springframework.session.data.redis.RedisIndexedSessionRepository.RedisSession; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisIndexedHttpSession; -import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -48,7 +47,7 @@ * @see Related * GitHub Issue */ -@ExtendWith(SpringExtension.class) +@SpringJUnitConfig class RedisIndexedSessionRepositoryDynamicITests extends AbstractRedisITests { private RedisIndexedSessionRepository sessionRepository; diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryITests.java index b9798a95f..4898496cf 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 the original author or authors. + * Copyright 2014-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. @@ -23,7 +23,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -43,9 +42,7 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisIndexedHttpSession; import org.springframework.session.events.SessionCreatedEvent; import org.springframework.session.events.SessionDestroyedEvent; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatNoException; @@ -56,9 +53,7 @@ * @author Rob Winch * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisIndexedSessionRepositoryITests extends AbstractRedisITests { private static final String SPRING_SECURITY_CONTEXT = "SPRING_SECURITY_CONTEXT"; diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisSessionRepositoryITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisSessionRepositoryITests.java index 00cdf526b..6bf047f09 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisSessionRepositoryITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -23,16 +23,13 @@ import java.util.UUID; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.session.MapSession; import org.springframework.session.data.redis.RedisSessionRepository.RedisSession; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; @@ -42,9 +39,7 @@ * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisSessionRepositoryITests extends AbstractRedisITests { @Autowired diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisSessionRepositoryKeyMissITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisSessionRepositoryKeyMissITests.java index ec6e954a7..b3e6db5a3 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisSessionRepositoryKeyMissITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisSessionRepositoryKeyMissITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 the original author or authors. + * Copyright 2014-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. @@ -21,7 +21,6 @@ import java.util.function.BiFunction; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -31,7 +30,7 @@ import org.springframework.session.config.SessionRepositoryCustomizer; import org.springframework.session.data.redis.RedisSessionRepository.RedisSession; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; -import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -49,7 +48,7 @@ * @see Related * GitHub Issue */ -@ExtendWith(SpringExtension.class) +@SpringJUnitConfig class RedisSessionRepositoryKeyMissITests extends AbstractRedisITests { private RedisSessionRepository sessionRepository; diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/SortedSetRedisSessionExpirationStoreITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/SortedSetRedisSessionExpirationStoreITests.java index 9ee2582a1..513627aea 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/SortedSetRedisSessionExpirationStoreITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/SortedSetRedisSessionExpirationStoreITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-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. @@ -23,7 +23,6 @@ import java.time.ZoneOffset; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -34,8 +33,7 @@ import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.session.data.redis.RedisIndexedSessionRepository.RedisSession; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; @@ -46,9 +44,8 @@ * * @author Marcus da Coregio */ -@ExtendWith(SpringExtension.class) +@SpringJUnitWebConfig @ContextConfiguration(classes = SortedSetRedisSessionExpirationStoreITests.Config.class) -@WebAppConfiguration class SortedSetRedisSessionExpirationStoreITests { @Autowired diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisIndexedHttpSessionExpireSessionDestroyedTests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisIndexedHttpSessionExpireSessionDestroyedTests.java index 744ba6d78..f1e37dab8 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisIndexedHttpSessionExpireSessionDestroyedTests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisIndexedHttpSessionExpireSessionDestroyedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -20,7 +20,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; @@ -35,15 +34,11 @@ import org.springframework.session.SessionRepository; import org.springframework.session.data.redis.AbstractRedisITests; import org.springframework.session.events.SessionExpiredEvent; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class EnableRedisIndexedHttpSessionExpireSessionDestroyedTests extends AbstractRedisITests { @Autowired diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/flushimmediately/RedisIndexedSessionRepositoryFlushImmediatelyITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/flushimmediately/RedisIndexedSessionRepositoryFlushImmediatelyITests.java index 87f53d06c..faafd07a9 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/flushimmediately/RedisIndexedSessionRepositoryFlushImmediatelyITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/flushimmediately/RedisIndexedSessionRepositoryFlushImmediatelyITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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,7 +17,6 @@ package org.springframework.session.data.redis.flushimmediately; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -26,15 +25,11 @@ import org.springframework.session.SessionRepository; import org.springframework.session.data.redis.AbstractRedisITests; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisIndexedSessionRepositoryFlushImmediatelyITests extends AbstractRedisITests { @Autowired diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/taskexecutor/RedisListenerContainerTaskExecutorITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/taskexecutor/RedisListenerContainerTaskExecutorITests.java index 15dc00ec2..a4c07265b 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/taskexecutor/RedisListenerContainerTaskExecutorITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/taskexecutor/RedisListenerContainerTaskExecutorITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -33,18 +32,14 @@ import org.springframework.session.data.redis.AbstractRedisITests; import org.springframework.session.data.redis.config.annotation.SpringSessionRedisOperations; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisIndexedHttpSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; /** * @author Vladimir Tsanev */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisListenerContainerTaskExecutorITests extends AbstractRedisITests { @Autowired diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationClassPathXmlApplicationContextTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationClassPathXmlApplicationContextTests.java index 103621b60..9ef498fc9 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationClassPathXmlApplicationContextTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationClassPathXmlApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -19,14 +19,12 @@ import java.util.Properties; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisServerCommands; import org.springframework.data.redis.connection.SubscriptionListener; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -39,8 +37,7 @@ * @author Mark Paluch * */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration +@SpringJUnitConfig class RedisHttpSessionConfigurationClassPathXmlApplicationContextTests { // gh-318 diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideDefaultSerializerTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideDefaultSerializerTests.java index 7ac14fb65..b1c74328f 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideDefaultSerializerTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideDefaultSerializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -19,7 +19,6 @@ import java.util.Properties; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -31,9 +30,7 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.session.data.redis.config.annotation.SpringSessionRedisOperations; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -47,9 +44,7 @@ * @author Mark Paluch * */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisHttpSessionConfigurationOverrideDefaultSerializerTests { @SpringSessionRedisOperations diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlCustomExpireTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlCustomExpireTests.java index 69505edc5..fe61fe0b2 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlCustomExpireTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlCustomExpireTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -19,15 +19,12 @@ import java.util.Properties; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisServerCommands; import org.springframework.data.redis.connection.SubscriptionListener; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -35,9 +32,7 @@ import static org.mockito.BDDMockito.willAnswer; import static org.mockito.Mockito.mock; -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisHttpSessionConfigurationXmlCustomExpireTests { @Test diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlTests.java index ff619a548..ec34335b4 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -19,15 +19,12 @@ import java.util.Properties; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisServerCommands; import org.springframework.data.redis.connection.SubscriptionListener; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -35,9 +32,7 @@ import static org.mockito.BDDMockito.willAnswer; import static org.mockito.Mockito.mock; -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisHttpSessionConfigurationXmlTests { @Test diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationNoOpConfigureRedisActionTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationNoOpConfigureRedisActionTests.java index 30c9b0d60..d9f44b5bf 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationNoOpConfigureRedisActionTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationNoOpConfigureRedisActionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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,7 +17,6 @@ package org.springframework.session.data.redis.config.annotation.web.http; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -25,9 +24,7 @@ import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.SubscriptionListener; import org.springframework.session.data.redis.config.ConfigureRedisAction; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; @@ -37,9 +34,7 @@ /** * @author Rob Winch */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisIndexedHttpSessionConfigurationNoOpConfigureRedisActionTests { @Test diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutor.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutor.java index 07b727efa..f57ffe536 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutor.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -20,7 +20,6 @@ import java.util.concurrent.Executor; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -30,9 +29,7 @@ import org.springframework.data.redis.connection.RedisServerCommands; import org.springframework.data.redis.connection.SubscriptionListener; import org.springframework.data.redis.listener.RedisMessageListenerContainer; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -46,9 +43,7 @@ * @author Vladimir Tsanev * */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutor { @Autowired diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutors.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutors.java index eebb360d7..71c4cc90c 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutors.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutors.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -20,7 +20,6 @@ import java.util.concurrent.Executor; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -30,9 +29,7 @@ import org.springframework.data.redis.connection.RedisServerCommands; import org.springframework.data.redis.connection.SubscriptionListener; import org.springframework.data.redis.listener.RedisMessageListenerContainer; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -48,9 +45,7 @@ * @author Mark Paluch * */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisIndexedHttpSessionConfigurationOverrideSessionTaskExecutors { @Autowired diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/gh109/Gh109Tests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/gh109/Gh109Tests.java index 5ecc4daf3..682214e5e 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/gh109/Gh109Tests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/gh109/Gh109Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -20,7 +20,6 @@ import java.util.Properties; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; @@ -32,9 +31,7 @@ import org.springframework.data.redis.core.RedisOperations; import org.springframework.session.data.redis.RedisIndexedSessionRepository; import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -48,9 +45,7 @@ * @author Rob Winch * @author Mark Paluch */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class Gh109Tests { @Test diff --git a/spring-session-docs/modules/ROOT/examples/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java b/spring-session-docs/modules/ROOT/examples/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java index 7105b3a64..f5889004d 100644 --- a/spring-session-docs/modules/ROOT/examples/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java +++ b/spring-session-docs/modules/ROOT/examples/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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,7 +17,6 @@ package docs; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.connection.RedisConnection; @@ -25,9 +24,7 @@ import org.springframework.data.redis.connection.SubscriptionListener; import org.springframework.session.Session; import org.springframework.session.web.http.SessionRepositoryFilter; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -38,9 +35,7 @@ /** * @author Rob Winch */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class HttpSessionConfigurationNoOpConfigureRedisActionXmlTests { @Autowired diff --git a/spring-session-docs/modules/ROOT/examples/java/docs/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java b/spring-session-docs/modules/ROOT/examples/java/docs/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java index a512dfc4f..bcdcfd0ee 100644 --- a/spring-session-docs/modules/ROOT/examples/java/docs/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java +++ b/spring-session-docs/modules/ROOT/examples/java/docs/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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,7 +17,6 @@ package docs; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -26,9 +25,7 @@ import org.springframework.data.redis.connection.SubscriptionListener; import org.springframework.session.data.redis.config.ConfigureRedisAction; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; @@ -38,9 +35,7 @@ /** * @author Rob Winch */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class RedisHttpSessionConfigurationNoOpConfigureRedisActionTests { @Test diff --git a/spring-session-docs/modules/ROOT/examples/java/docs/http/AbstractHttpSessionListenerTests.java b/spring-session-docs/modules/ROOT/examples/java/docs/http/AbstractHttpSessionListenerTests.java index 67e104c5a..a78801586 100644 --- a/spring-session-docs/modules/ROOT/examples/java/docs/http/AbstractHttpSessionListenerTests.java +++ b/spring-session-docs/modules/ROOT/examples/java/docs/http/AbstractHttpSessionListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -19,7 +19,6 @@ import java.util.Properties; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; @@ -31,8 +30,7 @@ import org.springframework.security.core.session.SessionDestroyedEvent; import org.springframework.session.MapSession; import org.springframework.session.Session; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -46,8 +44,7 @@ * @author Mark Paluch * @since 1.2 */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration +@SpringJUnitWebConfig public abstract class AbstractHttpSessionListenerTests { @Autowired diff --git a/spring-session-docs/modules/ROOT/examples/java/docs/security/RememberMeSecurityConfigurationTests.java b/spring-session-docs/modules/ROOT/examples/java/docs/security/RememberMeSecurityConfigurationTests.java index 7baa9fc0d..5cf67f713 100644 --- a/spring-session-docs/modules/ROOT/examples/java/docs/security/RememberMeSecurityConfigurationTests.java +++ b/spring-session-docs/modules/ROOT/examples/java/docs/security/RememberMeSecurityConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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,15 +22,13 @@ import jakarta.servlet.http.Cookie; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.session.Session; import org.springframework.session.SessionRepository; import org.springframework.session.web.http.SessionRepositoryFilter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -44,9 +42,8 @@ * @author rwinch * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) +@SpringJUnitWebConfig @ContextConfiguration(classes = RememberMeSecurityConfiguration.class) -@WebAppConfiguration @SuppressWarnings("rawtypes") class RememberMeSecurityConfigurationTests { diff --git a/spring-session-docs/modules/ROOT/examples/java/docs/security/RememberMeSecurityConfigurationXmlTests.java b/spring-session-docs/modules/ROOT/examples/java/docs/security/RememberMeSecurityConfigurationXmlTests.java index 764f97fd9..2f91f5bd4 100644 --- a/spring-session-docs/modules/ROOT/examples/java/docs/security/RememberMeSecurityConfigurationXmlTests.java +++ b/spring-session-docs/modules/ROOT/examples/java/docs/security/RememberMeSecurityConfigurationXmlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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,15 +22,12 @@ import jakarta.servlet.http.Cookie; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.session.Session; import org.springframework.session.SessionRepository; import org.springframework.session.web.http.SessionRepositoryFilter; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -44,9 +41,7 @@ * @author rwinch * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig @SuppressWarnings("rawtypes") class RememberMeSecurityConfigurationXmlTests { diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/ClientServerHazelcastIndexedSessionRepositoryITests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/ClientServerHazelcastIndexedSessionRepositoryITests.java index 6ad27e22b..ec94ab042 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/ClientServerHazelcastIndexedSessionRepositoryITests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/ClientServerHazelcastIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -21,7 +21,6 @@ import com.hazelcast.core.HazelcastInstance; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.GenericContainer; import org.testcontainers.images.builder.ImageFromDockerfile; import org.testcontainers.utility.MountableFile; @@ -32,9 +31,7 @@ import org.springframework.session.Session; import org.springframework.session.SessionIdGenerator; import org.springframework.session.hazelcast.config.annotation.web.http.EnableHazelcastHttpSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link HazelcastIndexedSessionRepository} using client-server @@ -43,9 +40,7 @@ * @author Vedran Pavic * @author Artem Bilan */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class ClientServerHazelcastIndexedSessionRepositoryITests extends AbstractHazelcastIndexedSessionRepositoryITests { // @formatter:off diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/EmbeddedHazelcastIndexedSessionRepositoryITests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/EmbeddedHazelcastIndexedSessionRepositoryITests.java index bc1afaa99..8b870f3e9 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/EmbeddedHazelcastIndexedSessionRepositoryITests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/EmbeddedHazelcastIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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,14 +17,11 @@ package org.springframework.session.hazelcast; import com.hazelcast.core.HazelcastInstance; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.session.hazelcast.config.annotation.web.http.EnableHazelcastHttpSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link HazelcastIndexedSessionRepository} using embedded @@ -33,9 +30,7 @@ * @author Tommy Ludwig * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class EmbeddedHazelcastIndexedSessionRepositoryITests extends AbstractHazelcastIndexedSessionRepositoryITests { @EnableHazelcastHttpSession diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/FlushImmediateHazelcastIndexedSessionRepositoryITests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/FlushImmediateHazelcastIndexedSessionRepositoryITests.java index 89936ad8b..6ba3b57cb 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/FlushImmediateHazelcastIndexedSessionRepositoryITests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/FlushImmediateHazelcastIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 the original author or authors. + * Copyright 2014-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. @@ -20,7 +20,6 @@ import com.hazelcast.core.HazelcastInstance; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -32,9 +31,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.session.FlushMode; import org.springframework.session.hazelcast.config.annotation.web.http.EnableHazelcastHttpSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -44,9 +41,7 @@ * * @author Eleftheria Stein */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class FlushImmediateHazelcastIndexedSessionRepositoryITests { @Autowired diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/SessionEventHazelcastIndexedSessionRepositoryTests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/SessionEventHazelcastIndexedSessionRepositoryTests.java index d27c951aa..d76779c5d 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/SessionEventHazelcastIndexedSessionRepositoryTests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/SessionEventHazelcastIndexedSessionRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 the original author or authors. + * Copyright 2014-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,6 @@ import com.hazelcast.core.HazelcastInstance; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -39,9 +38,7 @@ import org.springframework.session.events.SessionDeletedEvent; import org.springframework.session.events.SessionExpiredEvent; import org.springframework.session.hazelcast.config.annotation.web.http.EnableHazelcastHttpSession; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -53,9 +50,7 @@ * @author Tommy Ludwig * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@WebAppConfiguration +@SpringJUnitWebConfig class SessionEventHazelcastIndexedSessionRepositoryTests { private static final int MAX_INACTIVE_INTERVAL_IN_SECONDS = 2; diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/Db2JdbcIndexedSessionRepositoryCustomizerITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/Db2JdbcIndexedSessionRepositoryCustomizerITests.java index b7611131f..8f527242e 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/Db2JdbcIndexedSessionRepositoryCustomizerITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/Db2JdbcIndexedSessionRepositoryCustomizerITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-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. @@ -16,13 +16,9 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using IBM DB2 database with @@ -30,9 +26,7 @@ * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class Db2JdbcIndexedSessionRepositoryCustomizerITests extends Db2JdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/Db2JdbcIndexedSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/Db2JdbcIndexedSessionRepositoryITests.java index 30daecebd..b95607192 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/Db2JdbcIndexedSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/Db2JdbcIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -16,24 +16,19 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.JdbcDatabaseContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using IBM DB2 database. * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class Db2JdbcIndexedSessionRepositoryITests extends AbstractContainerJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/DerbyJdbcIndexedSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/DerbyJdbcIndexedSessionRepositoryITests.java index f8965e04d..090d9d10e 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/DerbyJdbcIndexedSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/DerbyJdbcIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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. @@ -16,25 +16,19 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using Derby database. * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class DerbyJdbcIndexedSessionRepositoryITests extends AbstractJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/H2JdbcIndexedSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/H2JdbcIndexedSessionRepositoryITests.java index d3174a18a..dbeed5f24 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/H2JdbcIndexedSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/H2JdbcIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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. @@ -16,25 +16,19 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using H2 database. * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class H2JdbcIndexedSessionRepositoryITests extends AbstractJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/HsqldbJdbcIndexedSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/HsqldbJdbcIndexedSessionRepositoryITests.java index c7da3cbd7..2adfc946a 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/HsqldbJdbcIndexedSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/HsqldbJdbcIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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. @@ -16,25 +16,19 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using HSQLDB database. * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class HsqldbJdbcIndexedSessionRepositoryITests extends AbstractJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDbJdbcIndexedSessionRepositoryCustomizerITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDbJdbcIndexedSessionRepositoryCustomizerITests.java index 5e66ba4a7..2ac3f9a6b 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDbJdbcIndexedSessionRepositoryCustomizerITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDbJdbcIndexedSessionRepositoryCustomizerITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-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. @@ -16,13 +16,9 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using MariaDB database with @@ -30,9 +26,7 @@ * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class MariaDbJdbcIndexedSessionRepositoryCustomizerITests extends MariaDbJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDbJdbcIndexedSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDbJdbcIndexedSessionRepositoryITests.java index dc77daf57..1cf7dce40 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDbJdbcIndexedSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDbJdbcIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -16,24 +16,19 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.JdbcDatabaseContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using MariaDB database. * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class MariaDbJdbcIndexedSessionRepositoryITests extends AbstractContainerJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySqlJdbcIndexedSessionRepositoryCustomizerITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySqlJdbcIndexedSessionRepositoryCustomizerITests.java index 8013a8bd4..ef345fbed 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySqlJdbcIndexedSessionRepositoryCustomizerITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySqlJdbcIndexedSessionRepositoryCustomizerITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-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. @@ -16,13 +16,9 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using MySQL database with @@ -30,9 +26,7 @@ * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class MySqlJdbcIndexedSessionRepositoryCustomizerITests extends MySqlJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySqlJdbcIndexedSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySqlJdbcIndexedSessionRepositoryITests.java index 8c3a0ca47..5ff8ed5f4 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySqlJdbcIndexedSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySqlJdbcIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -16,24 +16,19 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.JdbcDatabaseContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using MySQL database. * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class MySqlJdbcIndexedSessionRepositoryITests extends AbstractContainerJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcIndexedSessionRepositoryCustomizerITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcIndexedSessionRepositoryCustomizerITests.java index b44bd54e5..0805996e2 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcIndexedSessionRepositoryCustomizerITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcIndexedSessionRepositoryCustomizerITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-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. @@ -16,13 +16,9 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using Oracle database with @@ -30,9 +26,7 @@ * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class OracleJdbcIndexedSessionRepositoryCustomizerITests extends OracleJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcIndexedSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcIndexedSessionRepositoryITests.java index 47020774f..7489d799a 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcIndexedSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -16,24 +16,19 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.JdbcDatabaseContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using Oracle database. * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class OracleJdbcIndexedSessionRepositoryITests extends AbstractContainerJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSqlJdbcIndexedSessionRepositoryCustomizerITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSqlJdbcIndexedSessionRepositoryCustomizerITests.java index 68504c01d..668f9a7ab 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSqlJdbcIndexedSessionRepositoryCustomizerITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSqlJdbcIndexedSessionRepositoryCustomizerITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-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. @@ -16,13 +16,9 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using PostgreSQL database @@ -30,9 +26,7 @@ * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class PostgreSqlJdbcIndexedSessionRepositoryCustomizerITests extends PostgreSqlJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSqlJdbcIndexedSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSqlJdbcIndexedSessionRepositoryITests.java index 8bae4de25..1abf592be 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSqlJdbcIndexedSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSqlJdbcIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -16,24 +16,19 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.JdbcDatabaseContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using PostgreSQL database. * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class PostgreSqlJdbcIndexedSessionRepositoryITests extends AbstractContainerJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcIndexedSessionRepositoryCustomizerITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcIndexedSessionRepositoryCustomizerITests.java index 568d09ba2..6374ca15f 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcIndexedSessionRepositoryCustomizerITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcIndexedSessionRepositoryCustomizerITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-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. @@ -16,13 +16,9 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using SQL Server database @@ -30,9 +26,7 @@ * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class SqlServerJdbcIndexedSessionRepositoryCustomizerITests extends SqlServerJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcIndexedSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcIndexedSessionRepositoryITests.java index 80262f0a2..2a4937235 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcIndexedSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcIndexedSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -16,15 +16,12 @@ package org.springframework.session.jdbc; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.JdbcDatabaseContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; /** * Integration tests for {@link JdbcIndexedSessionRepository} using Microsoft SQL Server @@ -32,9 +29,7 @@ * * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) -@WebAppConfiguration -@ContextConfiguration +@SpringJUnitWebConfig class SqlServerJdbcIndexedSessionRepositoryITests extends AbstractContainerJdbcIndexedSessionRepositoryITests { @Configuration diff --git a/spring-session-samples/spring-session-sample-boot-findbyusername/src/integration-test/java/sample/FindByUsernameTests.java b/spring-session-samples/spring-session-sample-boot-findbyusername/src/integration-test/java/sample/FindByUsernameTests.java index c4e15753f..2f4ef74b1 100644 --- a/spring-session-samples/spring-session-sample-boot-findbyusername/src/integration-test/java/sample/FindByUsernameTests.java +++ b/spring-session-samples/spring-session-sample-boot-findbyusername/src/integration-test/java/sample/FindByUsernameTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -19,7 +19,6 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import org.testcontainers.containers.GenericContainer; import sample.pages.HomePage; @@ -32,7 +31,6 @@ import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder; @@ -41,7 +39,6 @@ * @author Rob Winch * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) @AutoConfigureMockMvc @SpringBootTest(webEnvironment = WebEnvironment.MOCK) class FindByUsernameTests { diff --git a/spring-session-samples/spring-session-sample-boot-findbyusername/src/test/java/sample/session/SessionDetailsFilterTests.java b/spring-session-samples/spring-session-sample-boot-findbyusername/src/test/java/sample/session/SessionDetailsFilterTests.java index 9a2b5de91..9a0bca8d5 100644 --- a/spring-session-samples/spring-session-sample-boot-findbyusername/src/test/java/sample/session/SessionDetailsFilterTests.java +++ b/spring-session-samples/spring-session-sample-boot-findbyusername/src/test/java/sample/session/SessionDetailsFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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. @@ -19,12 +19,11 @@ import com.maxmind.geoip2.DatabaseReader; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import sample.config.GeoConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -32,7 +31,7 @@ * @author Rob Winch * */ -@ExtendWith(SpringExtension.class) +@SpringJUnitConfig @ContextConfiguration(classes = GeoConfig.class) class SessionDetailsFilterTests { diff --git a/spring-session-samples/spring-session-sample-boot-jdbc/src/integration-test/java/sample/BootTests.java b/spring-session-samples/spring-session-sample-boot-jdbc/src/integration-test/java/sample/BootTests.java index 35a001349..506b69a23 100644 --- a/spring-session-samples/spring-session-sample-boot-jdbc/src/integration-test/java/sample/BootTests.java +++ b/spring-session-samples/spring-session-sample-boot-jdbc/src/integration-test/java/sample/BootTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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. @@ -19,7 +19,6 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import sample.pages.HomePage; import sample.pages.LoginPage; @@ -28,7 +27,6 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder; @@ -36,7 +34,6 @@ * @author Eddú Meléndez * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) @AutoConfigureMockMvc @SpringBootTest(webEnvironment = WebEnvironment.MOCK) class BootTests { diff --git a/spring-session-samples/spring-session-sample-boot-redis-json/src/integration-test/java/sample/HttpRedisJsonTest.java b/spring-session-samples/spring-session-sample-boot-redis-json/src/integration-test/java/sample/HttpRedisJsonTest.java index 7b3d5b23c..f9d30d208 100644 --- a/spring-session-samples/spring-session-sample-boot-redis-json/src/integration-test/java/sample/HttpRedisJsonTest.java +++ b/spring-session-samples/spring-session-sample-boot-redis-json/src/integration-test/java/sample/HttpRedisJsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -21,7 +21,6 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import org.testcontainers.containers.GenericContainer; import sample.pages.HomePage; @@ -35,7 +34,6 @@ import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder; @@ -45,7 +43,6 @@ * @author Eddú Meléndez * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.MOCK) @AutoConfigureMockMvc class HttpRedisJsonTest { diff --git a/spring-session-samples/spring-session-sample-boot-redis-json/src/integration-test/java/sample/RedisSerializerTest.java b/spring-session-samples/spring-session-sample-boot-redis-json/src/integration-test/java/sample/RedisSerializerTest.java index dde4746c4..521f6b914 100644 --- a/spring-session-samples/spring-session-sample-boot-redis-json/src/integration-test/java/sample/RedisSerializerTest.java +++ b/spring-session-samples/spring-session-sample-boot-redis-json/src/integration-test/java/sample/RedisSerializerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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,7 +17,6 @@ package sample; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.GenericContainer; import org.springframework.boot.test.context.SpringBootTest; @@ -27,7 +26,6 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; import org.springframework.session.data.redis.config.annotation.SpringSessionRedisOperations; -import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -35,7 +33,6 @@ * @author jitendra * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) @SpringBootTest class RedisSerializerTest { diff --git a/spring-session-samples/spring-session-sample-boot-redis/src/integration-test/java/sample/BootTests.java b/spring-session-samples/spring-session-sample-boot-redis/src/integration-test/java/sample/BootTests.java index 1cda5aaf9..8dc83f803 100644 --- a/spring-session-samples/spring-session-sample-boot-redis/src/integration-test/java/sample/BootTests.java +++ b/spring-session-samples/spring-session-sample-boot-redis/src/integration-test/java/sample/BootTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -19,7 +19,6 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import org.testcontainers.containers.GenericContainer; import sample.pages.HomePage; @@ -32,7 +31,6 @@ import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder; @@ -40,7 +38,6 @@ * @author Eddú Meléndez * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) @AutoConfigureMockMvc @SpringBootTest(webEnvironment = WebEnvironment.MOCK) class BootTests { diff --git a/spring-session-samples/spring-session-sample-boot-webflux-custom-cookie/src/integration-test/java/sample/AttributeTests.java b/spring-session-samples/spring-session-sample-boot-webflux-custom-cookie/src/integration-test/java/sample/AttributeTests.java index 796cefbd7..062719b91 100644 --- a/spring-session-samples/spring-session-sample-boot-webflux-custom-cookie/src/integration-test/java/sample/AttributeTests.java +++ b/spring-session-samples/spring-session-sample-boot-webflux-custom-cookie/src/integration-test/java/sample/AttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -21,7 +21,6 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.testcontainers.containers.GenericContainer; @@ -34,14 +33,12 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; /** * @author Eleftheria Stein */ -@ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) class AttributeTests { diff --git a/spring-session-samples/spring-session-sample-boot-webflux/src/integration-test/java/sample/AttributeTests.java b/spring-session-samples/spring-session-sample-boot-webflux/src/integration-test/java/sample/AttributeTests.java index 2e4898956..c91b24865 100644 --- a/spring-session-samples/spring-session-sample-boot-webflux/src/integration-test/java/sample/AttributeTests.java +++ b/spring-session-samples/spring-session-sample-boot-webflux/src/integration-test/java/sample/AttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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. @@ -21,7 +21,6 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.testcontainers.containers.GenericContainer; @@ -34,7 +33,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -43,7 +41,6 @@ * @author Rob Winch * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) class AttributeTests { diff --git a/spring-session-samples/spring-session-sample-boot-websocket/src/integration-test/java/sample/ApplicationTests.java b/spring-session-samples/spring-session-sample-boot-websocket/src/integration-test/java/sample/ApplicationTests.java index 1a837aaf1..d3e7b38e6 100644 --- a/spring-session-samples/spring-session-sample-boot-websocket/src/integration-test/java/sample/ApplicationTests.java +++ b/spring-session-samples/spring-session-sample-boot-websocket/src/integration-test/java/sample/ApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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,6 @@ import java.util.concurrent.ExecutionException; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.GenericContainer; import org.springframework.beans.factory.annotation.Autowired; @@ -32,7 +31,6 @@ import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketSession; @@ -48,7 +46,6 @@ * @author Rob Winch * @author Vedran Pavic */ -@ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) class ApplicationTests { diff --git a/spring-session-samples/spring-session-sample-javaconfig-rest/src/integration-test/java/rest/RestMockMvcTests.java b/spring-session-samples/spring-session-sample-javaconfig-rest/src/integration-test/java/rest/RestMockMvcTests.java index 8bc05bb05..7ca9790ef 100644 --- a/spring-session-samples/spring-session-sample-javaconfig-rest/src/integration-test/java/rest/RestMockMvcTests.java +++ b/spring-session-samples/spring-session-sample-javaconfig-rest/src/integration-test/java/rest/RestMockMvcTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-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,7 +18,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import org.testcontainers.containers.GenericContainer; import sample.SecurityConfig; import sample.mvc.MvcConfig; @@ -34,8 +34,6 @@ import org.springframework.session.web.http.HttpSessionIdResolver; import org.springframework.session.web.http.SessionRepositoryFilter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; @@ -48,9 +46,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@ExtendWith(SpringExtension.class) +@SpringJUnitWebConfig @ContextConfiguration(classes = { RestMockMvcTests.Config.class, SecurityConfig.class, MvcConfig.class }) -@WebAppConfiguration class RestMockMvcTests { private static final String DOCKER_IMAGE = "redis:7.0.4-alpine";