August 2017
Intermediate to advanced
332 pages
9h 16m
English
We executed our first migration, so the database is prepared. To see the complete example, we should also adapt our project so that it would access the database.
Let's first configure the Gradle dependencies to use the H2 database from the Spring Boot project. We can do this by adding the following lines to the build.gradle file:
dependencies { compile("org.springframework.boot:spring-boot-starter-data-jpa") compile("com.h2database:h2")}
The next step is to set up the database location and the startup behavior in the src/main/resources/application.properties file:
spring.datasource.url=jdbc:h2:file:/tmp/calculator;DB_CLOSE_ON_EXIT=FALSEspring.jpa.hibernate.ddl-auto=validate
The second line means that Spring Boot will not ...
Read now
Unlock full access