I am using SpringBoot to connect to MongoDB and perform read/write operations. I have used MongoDB uri for configuring the properties. Now my use case is that I want to read from primary and secondary DB at different places. Is there a way to do this in SpringBoot without having to configure two different MongoClient and MongoTemplate Beans? By easily setting any properties or fields?
I know i can set readPreference in MongoDB uri but that will be a generalization. I want to specifically read from primary and secondary DB using the same SpringBoot-autoConfigured MongoTemplate.