Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Refactor ReactiveMongoWebSessionConfiguration #19

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.session.config.annotation.web.server.EnableSpringWebSession;
import org.springframework.session.data.mongo.ReactiveMongoOperationsSessionRepository;

/**
Expand Down Expand Up @@ -50,7 +49,6 @@
@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
@Target({ java.lang.annotation.ElementType.TYPE })
@Documented
@EnableSpringWebSession
@Import(ReactiveMongoWebSessionConfiguration.class)
@Configuration
public @interface EnableMongoWebSession {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.ReactiveMongoOperations;
import org.springframework.session.config.annotation.web.server.SpringWebSessionConfiguration;
import org.springframework.session.data.mongo.AbstractMongoSessionConverter;
import org.springframework.session.data.mongo.ReactiveMongoOperationsSessionRepository;
import org.springframework.util.StringUtils;
Expand All @@ -35,7 +36,8 @@
* @author Greg Turnquist
*/
@Configuration
public class ReactiveMongoWebSessionConfiguration implements EmbeddedValueResolverAware, ImportAware {
public class ReactiveMongoWebSessionConfiguration extends SpringWebSessionConfiguration
implements EmbeddedValueResolverAware, ImportAware {

private AbstractMongoSessionConverter mongoSessionConverter;
private Integer maxInactiveIntervalInSeconds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void missingReactorSessionRepositoryBreaksAppContext() {

assertThatExceptionOfType(UnsatisfiedDependencyException.class)
.isThrownBy(this.context::refresh)
.withMessageContaining("Error creating bean with name 'webSessionManager'")
.withMessageContaining("Error creating bean with name 'reactiveMongoOperationsSessionRepository'")
.withMessageContaining("No qualifying bean of type '" + ReactiveMongoOperations.class.getCanonicalName());
}

Expand Down