Quick Guide on Loading Initial Data with Spring Boot

I just announced the new Spring 5 modules in REST With Spring:

1. Overview

Spring Boot makes it really easy to manage our database changes in an easy way. If we leave the default configuration, it’ll search for entities in our packages and create the respective tables automatically.

But sometimes we’ll need some finer grained control over the database alterations. That’s when we can use the data.sql and schema.sql files in Spring.

2. The data.sql File

Let’s also make the assumption here that we’re working with JPA – and define a simple Country entity in our project: