mardi 7 avril 2015

Switching between databases Spring MongoDb

I have a case, where I need to switch between the mongo databases using Spring mongodata (Version: 1.6.2). Currently, I have default database configured in db-config.xml with mongo template, and have annotated repositories; Need is to switch from one db/template to another at runtime; do necessary actions and switch back to default one. I referred to couple of links, Spring-data-mongodb connect to multiple databases in one Mongo instance and Making spring-data-mongodb multi-tenant I need to use same set of repositories at runtime. Is it possible to handle my case at configuration level? or do we need to extend Dbfactory to achieve this? with Dbfactory, can I use same set of annotated repositories?


Appreciate any help.


Aucun commentaire:

Enregistrer un commentaire