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

How to configure additional Datasource for Spring Session #96

Open visweshwar opened 5 years ago

visweshwar commented 5 years ago

I'm trying to route all session information to a dedicated datasource for session information. What I notice is that all the collections get written to the primary datasource even though there is a dedicated secondary datasource.

https://github.com/visweshwar/spring-session-multiple-mongo

Expected behavior

Collections should go to the second data source

Actual behavior

Spring session always goes to primary data source

Steps to reproduce

Run the application and you'll see the session collection getting created under first database.

Reactor Netty version

JVM version (e.g. java -version)

java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

OS version (e.g. uname -a)

Darwin-MacBook-Pro.local 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64