gpt4 book ai didi

spring - 如何在应用程序中配置 2 个数据库/模式

转载 作者:行者123 更新时间:2023-11-28 22:28:20 25 4
gpt4 key购买 nike

我正在使用 Spring Boot 进行应用程序开发。

我需要它来访问我的应用程序中的 2 个数据库/模式(都在 MySQL 数据库中)。

如何仅使用注释application.properties 文件来配置它?

目前我使用的是单一数据库:配置如下

tomcat的

context.xml

<Resource name="jdbc/user" auth="Container" type="javax.sql.DataSource"
username="***" password="***" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/user"/>

application.properties 在应用中:

spring.datasource.jndi-name=jdbc/user

spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=validate

我该如何配置,将另一个数据库/模式说成客户到此应用程序中。

提前致谢。

最佳答案

关于spring - 如何在应用程序中配置 2 个数据库/模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32722502/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com