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 41c5ddd1db..bf408e3cfc 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,6 +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.config.annotation.web.http.MongoHttpSessionConfiguration; /** @@ -36,7 +37,7 @@ import org.springframework.session.data.mongo.config.annotation.web.http.MongoHt * @author Stephane Nicoll */ @Configuration -@ConditionalOnClass(MongoHttpSessionConfiguration.class) +@ConditionalOnClass({ MongoOperations.class, MongoOperationsSessionRepository.class }) @ConditionalOnMissingBean(SessionRepository.class) @ConditionalOnBean(MongoOperations.class) @Conditional(ServletSessionCondition.class)