From 480801656060b5068007edfac14083ef3805625f Mon Sep 17 00:00:00 2001 From: Vedran Pavic Date: Tue, 1 Oct 2019 21:31:08 +0200 Subject: [PATCH] Align with Spring Session MongoDB deprecations See gh-18470 --- .../session/MongoReactiveSessionConfiguration.java | 4 ++-- .../autoconfigure/session/MongoSessionConfiguration.java | 4 ++-- .../autoconfigure/session/SessionAutoConfiguration.java | 4 ++-- .../session/ReactiveSessionAutoConfigurationMongoTests.java | 6 +++--- .../session/ReactiveSessionAutoConfigurationRedisTests.java | 4 ++-- .../session/SessionAutoConfigurationHazelcastTests.java | 4 ++-- .../session/SessionAutoConfigurationJdbcTests.java | 4 ++-- .../session/SessionAutoConfigurationMongoTests.java | 6 +++--- .../session/SessionAutoConfigurationRedisTests.java | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/MongoReactiveSessionConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/MongoReactiveSessionConfiguration.java index b7bd1f73ed..8522edadff 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/MongoReactiveSessionConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/MongoReactiveSessionConfiguration.java @@ -27,7 +27,7 @@ import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.core.ReactiveMongoOperations; import org.springframework.session.ReactiveSessionRepository; -import org.springframework.session.data.mongo.ReactiveMongoOperationsSessionRepository; +import org.springframework.session.data.mongo.ReactiveMongoSessionRepository; import org.springframework.session.data.mongo.config.annotation.web.reactive.ReactiveMongoWebSessionConfiguration; /** @@ -36,7 +36,7 @@ import org.springframework.session.data.mongo.config.annotation.web.reactive.Rea * @author Andy Wilkinson */ @Configuration(proxyBeanMethods = false) -@ConditionalOnClass({ ReactiveMongoOperations.class, ReactiveMongoOperationsSessionRepository.class }) +@ConditionalOnClass({ ReactiveMongoOperations.class, ReactiveMongoSessionRepository.class }) @ConditionalOnMissingBean(ReactiveSessionRepository.class) @ConditionalOnBean(ReactiveMongoOperations.class) @Conditional(ReactiveSessionCondition.class) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/MongoSessionConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/MongoSessionConfiguration.java index c90f6eafc8..2d2419cfac 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/MongoSessionConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/MongoSessionConfiguration.java @@ -27,7 +27,7 @@ import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.session.SessionRepository; -import org.springframework.session.data.mongo.MongoOperationsSessionRepository; +import org.springframework.session.data.mongo.MongoIndexedSessionRepository; import org.springframework.session.data.mongo.config.annotation.web.http.MongoHttpSessionConfiguration; /** @@ -37,7 +37,7 @@ import org.springframework.session.data.mongo.config.annotation.web.http.MongoHt * @author Stephane Nicoll */ @Configuration(proxyBeanMethods = false) -@ConditionalOnClass({ MongoOperations.class, MongoOperationsSessionRepository.class }) +@ConditionalOnClass({ MongoOperations.class, MongoIndexedSessionRepository.class }) @ConditionalOnMissingBean(SessionRepository.class) @ConditionalOnBean(MongoOperations.class) @Conditional(ServletSessionCondition.class) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java index 91b6cea627..ea9e253b42 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java @@ -266,7 +266,7 @@ public class SessionAutoConfiguration { super(applicationContext, sessionProperties, Arrays.asList("org.springframework.session.hazelcast.HazelcastIndexedSessionRepository", "org.springframework.session.jdbc.JdbcIndexedSessionRepository", - "org.springframework.session.data.mongo.MongoOperationsSessionRepository", + "org.springframework.session.data.mongo.MongoIndexedSessionRepository", "org.springframework.session.data.redis.RedisIndexedSessionRepository")); } @@ -283,7 +283,7 @@ public class SessionAutoConfiguration { SessionProperties sessionProperties) { super(applicationContext, sessionProperties, Arrays.asList("org.springframework.session.data.redis.ReactiveRedisSessionRepository", - "org.springframework.session.data.mongo.ReactiveMongoOperationsSessionRepository")); + "org.springframework.session.data.mongo.ReactiveMongoSessionRepository")); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationMongoTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationMongoTests.java index 5b1a1db0d6..bff4724409 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationMongoTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationMongoTests.java @@ -28,7 +28,7 @@ import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext; import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; -import org.springframework.session.data.mongo.ReactiveMongoOperationsSessionRepository; +import org.springframework.session.data.mongo.ReactiveMongoSessionRepository; import org.springframework.session.data.redis.ReactiveRedisSessionRepository; import static org.assertj.core.api.Assertions.assertThat; @@ -74,8 +74,8 @@ class ReactiveSessionAutoConfigurationMongoTests extends AbstractSessionAutoConf private ContextConsumer validateSpringSessionUsesMongo( String collectionName) { return (context) -> { - ReactiveMongoOperationsSessionRepository repository = validateSessionRepository(context, - ReactiveMongoOperationsSessionRepository.class); + ReactiveMongoSessionRepository repository = validateSessionRepository(context, + ReactiveMongoSessionRepository.class); assertThat(repository.getCollectionName()).isEqualTo(collectionName); }; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationRedisTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationRedisTests.java index 172b3b0cad..8ab4e9c581 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationRedisTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationRedisTests.java @@ -26,7 +26,7 @@ import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplic import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; import org.springframework.session.SaveMode; -import org.springframework.session.data.mongo.ReactiveMongoOperationsSessionRepository; +import org.springframework.session.data.mongo.ReactiveMongoSessionRepository; import org.springframework.session.data.redis.ReactiveRedisSessionRepository; import static org.assertj.core.api.Assertions.assertThat; @@ -53,7 +53,7 @@ class ReactiveSessionAutoConfigurationRedisTests extends AbstractSessionAutoConf @Test void defaultConfigWithUniqueStoreImplementation() { - this.contextRunner.withClassLoader(new FilteredClassLoader(ReactiveMongoOperationsSessionRepository.class)) + this.contextRunner.withClassLoader(new FilteredClassLoader(ReactiveMongoSessionRepository.class)) .withConfiguration( AutoConfigurations.of(RedisAutoConfiguration.class, RedisReactiveAutoConfiguration.class)) .run(validateSpringSessionUsesRedis("spring:session:", SaveMode.ON_SET_ATTRIBUTE)); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationHazelcastTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationHazelcastTests.java index ebb358f3d4..83bae517f4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationHazelcastTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationHazelcastTests.java @@ -28,7 +28,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.session.FlushMode; import org.springframework.session.SaveMode; -import org.springframework.session.data.mongo.MongoOperationsSessionRepository; +import org.springframework.session.data.mongo.MongoIndexedSessionRepository; import org.springframework.session.data.redis.RedisIndexedSessionRepository; import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository; import org.springframework.session.jdbc.JdbcIndexedSessionRepository; @@ -59,7 +59,7 @@ class SessionAutoConfigurationHazelcastTests extends AbstractSessionAutoConfigur void defaultConfigWithUniqueStoreImplementation() { this.contextRunner .withClassLoader(new FilteredClassLoader(JdbcIndexedSessionRepository.class, - RedisIndexedSessionRepository.class, MongoOperationsSessionRepository.class)) + RedisIndexedSessionRepository.class, MongoIndexedSessionRepository.class)) .run(this::validateDefaultConfig); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationJdbcTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationJdbcTests.java index fa2f1f25b3..fd8470c321 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationJdbcTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationJdbcTests.java @@ -32,7 +32,7 @@ import org.springframework.jdbc.BadSqlGrammarException; import org.springframework.jdbc.core.JdbcOperations; import org.springframework.session.FlushMode; import org.springframework.session.SaveMode; -import org.springframework.session.data.mongo.MongoOperationsSessionRepository; +import org.springframework.session.data.mongo.MongoIndexedSessionRepository; import org.springframework.session.data.redis.RedisIndexedSessionRepository; import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository; import org.springframework.session.jdbc.JdbcIndexedSessionRepository; @@ -63,7 +63,7 @@ class SessionAutoConfigurationJdbcTests extends AbstractSessionAutoConfiguration void defaultConfigWithUniqueStoreImplementation() { this.contextRunner .withClassLoader(new FilteredClassLoader(HazelcastIndexedSessionRepository.class, - MongoOperationsSessionRepository.class, RedisIndexedSessionRepository.class)) + MongoIndexedSessionRepository.class, RedisIndexedSessionRepository.class)) .run(this::validateDefaultConfig); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationMongoTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationMongoTests.java index 5cef01ee21..982bbb8a7e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationMongoTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationMongoTests.java @@ -26,7 +26,7 @@ import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; -import org.springframework.session.data.mongo.MongoOperationsSessionRepository; +import org.springframework.session.data.mongo.MongoIndexedSessionRepository; import org.springframework.session.data.redis.RedisIndexedSessionRepository; import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository; import org.springframework.session.jdbc.JdbcIndexedSessionRepository; @@ -72,8 +72,8 @@ class SessionAutoConfigurationMongoTests extends AbstractSessionAutoConfiguratio private ContextConsumer validateSpringSessionUsesMongo(String collectionName) { return (context) -> { - MongoOperationsSessionRepository repository = validateSessionRepository(context, - MongoOperationsSessionRepository.class); + MongoIndexedSessionRepository repository = validateSessionRepository(context, + MongoIndexedSessionRepository.class); assertThat(repository).hasFieldOrPropertyWithValue("collectionName", collectionName); }; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationRedisTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationRedisTests.java index 631061f988..7fc3a3ac69 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationRedisTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationRedisTests.java @@ -35,7 +35,7 @@ import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.session.FlushMode; import org.springframework.session.SaveMode; -import org.springframework.session.data.mongo.MongoOperationsSessionRepository; +import org.springframework.session.data.mongo.MongoIndexedSessionRepository; import org.springframework.session.data.redis.RedisIndexedSessionRepository; import org.springframework.session.data.redis.config.ConfigureNotifyKeyspaceEventsAction; import org.springframework.session.data.redis.config.ConfigureRedisAction; @@ -75,7 +75,7 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio void defaultConfigWithUniqueStoreImplementation() { this.contextRunner .withClassLoader(new FilteredClassLoader(HazelcastIndexedSessionRepository.class, - JdbcIndexedSessionRepository.class, MongoOperationsSessionRepository.class)) + JdbcIndexedSessionRepository.class, MongoIndexedSessionRepository.class)) .withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)) .withPropertyValues("spring.redis.port=" + redis.getFirstMappedPort()) .run(validateSpringSessionUsesRedis("spring:session:event:0:created:", FlushMode.ON_SAVE,