0

I have an api rest application with an h2 database where I store a user model. Everything works great when I launch my application directly via intellij or grace mvn spring-boot:run but when I launch the .jar of my application my h2 database looks empty. Maybe I forget a property in my application.properties or something else. Do you have any idea what the problem is and how to fix it?

there is my application.properties :

spring.datasource.url = jdbc:h2:mem:Users
spring.h2.console.enable=true
management.security.enable=false

and my data.sql file :

INSERT INTO user(firstname,lastname, cash, username, password) VALUES('Cristiano' , 'Ronaldo' , 150.5 , 'cr7' , 'realmadrid');

COMMIT;
marcOlivr
  • 13
  • 4
  • Does this answer your question? [Spring Boot - Loading Initial Data](https://stackoverflow.com/questions/38040572/spring-boot-loading-initial-data) See there is an answer with 45 voteups where you can see the application.proptierties. – Marcinek Dec 09 '20 at 17:34
  • Where are the files located in your project? Have you verified that the data.sql ended up in your jar file? – Mark Rotteveel Dec 10 '20 at 16:10

0 Answers0