I’m using spring-data-mongodb. I want to connect to 2 mongodb instance, have created 2 mongo clients and 2 mongo template successfully.
I wonder if can implement mongoTemplateRef inside EnableMongoRepositories to dynamically switch between 2 db?
@EnableMongoRepositories(value = "com.example.web.repository")
I’ve created 2 mongo clients and 2 mongo templates to connect to 2 mongo, but all command, query are sent to one db.
An Le is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.