search

Home  >  Q&A  >  body text

springmvc中如何同时使用两个mongodb数据库

可以指定实体类对应的是哪个数据库中的表吗?

PHPzPHPz2792 days ago614

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-04-28 09:05:32

    Configure two data sources, and use one of the following two solutions, which can also be used in combination:
    1. Customize annotation classes, annotate specified methods in the service layer, and use spring aop to perform aspects to control the data source
    2. Implementation Dynamically switch data sources and use spring aop for slicing to control the data source

    Reference: http://www.boboface.com/wiki, DB reading and writing are separated in the wiki tree. As for how the program connects to mongodb, you can find out by yourself. This is just to give you ideas on how to solve your problem

    reply
    0
  • Cancelreply