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

Spring session in a multidatasource environment #123

Closed
wants to merge 11 commits into from

Conversation

visweshwar
Copy link

@visweshwar visweshwar commented Jan 1, 2020

How to configure additional Datasource for Spring Session #96
#96

By default spring-session-data-mongodb assumes that the datasource in the project is exclusively used by spring session. If you have more than 1 dataSource, the very first bean gets elected to the primary Datasource for session. This is less than ideal. To account for this I've added an annotation to optionally elect the datasource of choice.

Expected behavior
The MongoTemplate annotated with SpringSessionMongoOperations will be chosen as the Session Datasource

Actual behavior
Currently the first Bean gets resolved as the MongoOperations of choice.

Steps to reproduce
https://github.com/visweshwar/spring-session-multiple-mongo can reproduce the issue.

visweshwar and others added 11 commits June 1, 2019 22:18
# Conflicts:
#	src/main/java/org/springframework/session/data/mongo/config/annotation/web/http/MongoHttpSessionConfiguration.java
#	src/main/java/org/springframework/session/data/mongo/config/annotation/web/http/SpringSessionMongoOperations.java
#	src/test/java/org/springframework/session/data/mongo/config/annotation/web/http/MongoHttpSessionConfigurationTest.java
@gregturn gregturn closed this Jun 15, 2020
@gregturn
Copy link
Contributor

This project has migrated from master to main as the "main" branch, thus causing your PR to close.

If you want to revisit this, please fetch and rebase your branch against main and you should be able to create pull request with all your commits.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants