I'm using spring boot in a maven project with the spring-boot-starter-data-jpa dependency.
In my application.yml file I have:
spring.datasource.url: jdbc:h2:./data;DB_CLOSE_ON_EXIT=FALSE
I also have a DataPopulation class with :
if (userRepository.findAll().iterator().hasNext()) {
// Database already has users..
}
Where userRepository is a CrudRepository instance.
On every start up the userRepository returns no users, regardless of how many were added the last time the application was running.
I can see that the data.mv.db and data.trace.db files are created and not empty.
Why is my database always empty on start up? What am I missing?