schema.sql and data.sql not loading on Spring Boot project startup

date
Aug 19, 2022
slug
schema-sql-and-data-sql-not-loading
status
Published
tags
Bugfix
MySQL
Spring Boot
summary
type
Post

Background

I created a schema.sql for my project that creates a new table called candy
and created an initialization script in data.sql that populates my candy table with some candy names and prices when the application starts.
 
 

What’s wrong

As of Spring Boot Version 2.7, the property spring.datasource.initialization-mode has been removed.

Solution

Add the replacement property to application.properties:

References


© Foy Wan 2022 - 2025