Skip to content

Commit 1ad39b5

Browse files
committed
Fix ReactiveSessionAutoConfigurationRedisTests
See gh-26714
1 parent 6fc57fa commit 1ad39b5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationRedisTests.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.springframework.boot.autoconfigure.AutoConfigurations;
2727
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
2828
import org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration;
29+
import org.springframework.boot.autoconfigure.web.reactive.WebSessionIdResolverAutoConfiguration;
2930
import org.springframework.boot.test.context.FilteredClassLoader;
3031
import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext;
3132
import org.springframework.boot.test.context.runner.ContextConsumer;
@@ -55,7 +56,8 @@ class ReactiveSessionAutoConfigurationRedisTests extends AbstractSessionAutoConf
5556
.withStartupTimeout(Duration.ofMinutes(10));
5657

5758
protected final ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner()
58-
.withConfiguration(AutoConfigurations.of(SessionAutoConfiguration.class));
59+
.withConfiguration(
60+
AutoConfigurations.of(SessionAutoConfiguration.class, WebSessionIdResolverAutoConfiguration.class));
5961

6062
@Test
6163
void defaultConfig() {
@@ -87,7 +89,7 @@ void defaultConfigWithCustomTimeout() {
8789

8890
@Test
8991
void defaultConfigWithCustomWebFluxTimeout() {
90-
this.contextRunner.withPropertyValues("spring.session.store-type=redis", "spring.webflux.session.timeout=1m")
92+
this.contextRunner.withPropertyValues("spring.session.store-type=redis", "server.reactive.session.timeout=1m")
9193
.withConfiguration(
9294
AutoConfigurations.of(RedisAutoConfiguration.class, RedisReactiveAutoConfiguration.class))
9395
.run((context) -> {
@@ -115,11 +117,11 @@ void sessionCookieConfigurationIsAppliedToAutoConfiguredWebSessionIdResolver() {
115117
.withUserConfiguration(Config.class)
116118
.withPropertyValues("spring.session.store-type=redis", "spring.redis.host=" + redis.getHost(),
117119
"spring.redis.port=" + redis.getFirstMappedPort(), "spring.session.store-type=redis",
118-
"spring.webflux.session.cookie.name:JSESSIONID",
119-
"spring.webflux.session.cookie.domain:.example.com",
120-
"spring.webflux.session.cookie.path:/example", "spring.webflux.session.cookie.max-age:60",
121-
"spring.webflux.session.cookie.http-only:false", "spring.webflux.session.cookie.secure:false",
122-
"spring.webflux.session.cookie.same-site:strict")
120+
"server.reactive.session.cookie.name:JSESSIONID",
121+
"server.reactive.session.cookie.domain:.example.com",
122+
"server.reactive.session.cookie.path:/example", "server.reactive.session.cookie.max-age:60",
123+
"server.reactive.session.cookie.http-only:false", "server.reactive.session.cookie.secure:false",
124+
"server.reactive.session.cookie.same-site:strict")
123125
.run(assertExchangeWithSession((exchange) -> {
124126
List<ResponseCookie> cookies = exchange.getResponse().getCookies().get("JSESSIONID");
125127
assertThat(cookies).isNotEmpty();

0 commit comments

Comments
 (0)