[Spring boot] Integrating with h2 database

In pom.xml add dependency:

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>

    </dependencies>

 

Then in application.properties:

spring.h2.console.enabled=true
spring.h2.console.path=/h2

 

Now, in the broswer, we can access h2 database though url: localhost:8080/h2

posted @ 2019-01-14 21:44  Zhentiw  阅读(178)  评论(0编辑  收藏  举报