[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

猜你喜欢

转载自www.cnblogs.com/Answer1215/p/10269225.html