The problem is that spring expects to find a file with either the name schema.sql
or data.sql
in the classpath to load.
But your file is named data-h2.sql
so spring will not consider it, even if it is correctly placed in resources.
It could search for a file with the name data-h2.sql
and load it if you had configured the property spring.datasource.platform = h2
.
Without using the aforementioned property, there are 2 solutions:
Rename the file into
data.sql
and be sure it is inside the resources folderDo not rename the file and use the following application property to inform spring about the name of the file that it should load
spring.sql.init.data-locations=classpath:data-h2.sql
CLICK HERE to find out more related problems solutions.