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

标签 spring tomcat spring-boot datasource jndi

我正在使用 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/

相关文章:

java - Maven 项目中测试资源的公共(public)位置

java - 如何使用java从外部服务器检查tomcat/mysql

Spring Boot Controller - 枚举参数作为值

java - Spring Boot Integration feed 由于不活动而 hibernate

java - Spring Boot - Firebase 管理 SDK - 通知

java - 如何在 JPQL 中使用别名

java - 带有 Spring Boot 1.5.* 的 Elastic Search 5.4

java.lang.IllegalArgumentException : Method must not be null 异常

maven - 默认的Maven tomcat插件在哪里配置的?

tomcat - 无法在集群中序列化 session