Spring H2 Support: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 21: Line 21:


<syntaxhighlight lang='text'>
<syntaxhighlight lang='text'>
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.url=jdbc:h2:tcp://localhost/mem:default
spring.datasource.username=something
spring.datasource.username=sa
spring.datasource.password=somethingelse
spring.datasource.password=
spring.datasource.platform=h2
 
spring.datasource.initialization-mode=always
spring.jpa.hibernate.ddl-auto=none
spring.jpa.show-sql=true
</syntaxhighlight>
</syntaxhighlight>



Revision as of 06:15, 19 October 2018

Internal

Overview

Dependencies

dependencies {

    implementation('org.springframework.boot:spring-boot-starter-data-jpa')
    runtimeOnly('com.h2database:h2')
}

Spring Configuration

Add in application.properties or equivalent:

spring.datasource.url=jdbc:h2:tcp://localhost/mem:default
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.platform=h2

spring.datasource.initialization-mode=always
spring.jpa.hibernate.ddl-auto=none
spring.jpa.show-sql=true

SpringBoot DevTools H2 Console

SpringBoot DevTools H2 Console