Align with Spring Session MongoDB deprecations

See gh-18470
pull/18477/head
Vedran Pavic 5 years ago committed by Andy Wilkinson
parent 6a5f608f30
commit 4808016560

@ -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)

@ -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)

@ -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"));
}
}

@ -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<AssertableReactiveWebApplicationContext> validateSpringSessionUsesMongo(
String collectionName) {
return (context) -> {
ReactiveMongoOperationsSessionRepository repository = validateSessionRepository(context,
ReactiveMongoOperationsSessionRepository.class);
ReactiveMongoSessionRepository repository = validateSessionRepository(context,
ReactiveMongoSessionRepository.class);
assertThat(repository.getCollectionName()).isEqualTo(collectionName);
};
}

@ -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));

@ -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);
}

@ -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);
}

@ -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<AssertableWebApplicationContext> validateSpringSessionUsesMongo(String collectionName) {
return (context) -> {
MongoOperationsSessionRepository repository = validateSessionRepository(context,
MongoOperationsSessionRepository.class);
MongoIndexedSessionRepository repository = validateSessionRepository(context,
MongoIndexedSessionRepository.class);
assertThat(repository).hasFieldOrPropertyWithValue("collectionName", collectionName);
};
}

@ -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,

Loading…
Cancel
Save