【发布时间】:2017-03-31 22:26:10
【问题描述】:
我正在尝试开始使用 spring-boot 与数据库的集成。
我已阅读官方29.1 Configure a DataSource 主题,这对我来说非常清楚。
我想用Heroku 发布我的应用程序,所以我查看了官方sample 项目配置。
pom.xml的一部分:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
//...
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</dependency>
//...
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1203-jdbc42</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.4.1</version>
</dependency>
我现在想知道,将 hsqldb 之类的内存数据库与普通的生产型数据库(此处为 postgres)一起使用的目的是什么?什么情况下有用?
更重要的是,这将如何运作?
编辑
Ofc,在我提到的示例项目中,我遗漏了一些东西。 application.properties 中的注释解释了为什么使用 hsql:
# Database Config
# Un-comment these lines to connect to a database. When commented out, you automatically get an in-memory-database.
#spring.jpa.hibernate.ddl-auto=update
【问题讨论】:
标签: java spring-boot hsqldb in-memory-database