postgresql - 你能在 Spring Boot 中连接到两个 postgres 数据库吗?

标签 postgresql spring-boot jdbctemplate

如果是,怎么办?

我正在编写一个归档项目,其中必须将一个数据库中的旧数据移动到另一个数据库。为此,我需要连接到 springboot 项目中的两个数据库。

如有任何指点,我们将不胜感激。

最佳答案

您需要提供两个不同的DataSources(两个不同的bean)。

看看http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-two-datasources

关于postgresql - 你能在 Spring Boot 中连接到两个 postgres 数据库吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40543985/

相关文章:

python - 如何关闭 PostgreSQL 数据库上的空闲连接

java - 在 Apache Camel 应用程序中,单元测试如何注入(inject)模拟端点来代替真实端点?

java - 多个一对多关系 ResultSetExtractor

java - Spring JdbcTemplate : Getting Lists Not Mapped to an Object

java - 具有 Spring session 和安全性的 Spring Boot。 RMI 失败并返回 401

java - 用于 JavaEE 和 CDI 的 JDBCTemplate

regex - 使用 regexp_split_to_array 将文本列拆分为 2

postgresql - Psql Docker : could not connect to server: No such file or directory

postgresql - pg_dump 数据库抛出错误 'out of shared memory'

java - JsonMappingException 的 Spring Boot 测试给出了低于标准的堆栈跟踪