zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

[Spring boot] Integrating with h2 database

2023-09-14 08:59:15 时间

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