How to Use Two mongodb Databases at the Same Time in springmvc

  mongodb, question

Can you specify which database table the entity class corresponds to?

Configure two data sources and use one of the following two schemes in combination:
1. Customize the annotation class, annotate the specified method at the service layer, and use spring aop to control the data source
2. Realize dynamic switching of data sources and use spring aop to control data sources

Reference:, wiki tree DB read and write separation, as for the program how to connect mongodb on their own to understand it, here is just to give ideas how to solve your problem