1-- You can simply create a data.sql file in your src/main/resources folder
2-- and it will be automatically executed on startup.
3-- In this file you just add some insert statements, eg.:
4
5INSERT INTO users (username, firstname, lastname) VALUES
6 ('lala', 'lala', 'lala'),
7 ('lolo', 'lolo', 'lolo');
8
9-- If you're using Spring boot 2, database initialization only works for
10-- embedded databases (H2, HSQLDB, ...). If you want to use it for other
11-- databases as well, you need to change the
12-- spring.datasource.initialization-mode property:
13
14spring.datasource.initialization-mode=always
15
1-- You can simply create a data.sql file in your src/main/resources folder
2-- and it will be automatically executed on startup.
3-- In this file you just add some insert statements, eg.:
4
5INSERT INTO users (username, firstname, lastname) VALUES
6 ('lala', 'lala', 'lala'),
7 ('lolo', 'lolo', 'lolo');
8
9-- If you're using Spring boot 2, database initialization only works for
10-- embedded databases (H2, HSQLDB, ...). If you want to use it for other
11-- databases as well, you need to change the
12-- spring.datasource.initialization-mode property:
13
14spring.datasource.initialization-mode=always