【问题标题】:How to choose the database at run time based on the product selection in Spring boot and MongoDB?Spring boot和MongoDB中如何根据产品选择在运行时选择数据库?
【发布时间】:2018-09-23 20:50:30
【问题描述】:

就我而言,我有三个不同的产品(例如:产品 1、产品 2、产品 3),每个产品都有不同的数据库(例如:Productdb1、Productdb2 和 Productdb3)和不同的域(例如:product1.com、 product2.com 和 product3.com),但 Appengine (API) 是相同的。域和 Appengine 将通过 REST 进行通信。

场景: 如果用户输入 product1.com,Appengine 将访问 Productdb1 数据库。如果用户在 product2.com 中输入,Appengine 将访问 Productdb2 数据库。

根据产品,API 应访问其相关数据库。

技术: Spring Boot、Spring Security、Spring 数据和 MongoDB

【问题讨论】:

    标签: spring mongodb spring-boot spring-security spring-data


    【解决方案1】:

    【讨论】:

    • 是的,你是对的@Sharadha。但是 baeldung(第一个链接)将 Hibernate 用于 mysql 数据库。然后我不会同时寻找不同的数据源,如 Mysql、Oracle 和 Mongodb 连接。我想成为具有单个数据源的多个数据库。
    猜你喜欢
    • 1970-01-01
    • 2014-10-21
    • 2022-01-13
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 2013-09-26
    • 2023-03-18
    • 2017-06-22
    相关资源
    最近更新 更多