Spring Boot. JPA. H2 Store data at working directory. Crud Repository example. Lombok annotations

Опубликовано: 11 Март 2026
на канале: Dev Reactor
95
6

Useful links:
https://www.baeldung.com/h2-embedded-...
https://www.baeldung.com/spring-boot-...
https://stackoverflow.com/questions/7...
https://stackoverflow.com/questions/5...
https://stackoverflow.com/questions/5...

file application.properties:
spring.jpa.show-sql=true
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console

spring.datasource.url=jdbc:h2:file:./testdb;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

spring.jpa.defer-datasource-initialization=true
spring.jpa.hibernate.ddl-auto=update