spring-projects / spring-session-data-mongodb

Spring Session for MongoDB
https://spring.io/projects/spring-session-data-mongodb
Apache License 2.0
50 stars 35 forks source link

Spring session in a multidatasource environment #123

Closed visweshwar closed 4 years ago

visweshwar commented 4 years ago

How to configure additional Datasource for Spring Session #96 https://github.com/spring-projects/spring-session-data-mongodb/issues/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.

gregturn commented 4 years ago

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.