Spring Boot 2.0 Projects
上QQ阅读APP看书,第一时间看更新

Using Spring Boot Devtools for database visualization

In order to ease the testing of database development via Spring Boot Devtools, a dependency can be used that will provide a GUI to visualize the tables created with the data when an embedded database such as H2 is used. This can be seen from the following code:

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>

With this Spring Boot Devtools enabled after the Spring Boot application's startup, accessing the http://<host>:<port>/h2-console (the port will be the same port as the Spring Boot application) URL will display the following H2 database console for ease of development:

After clicking the Connect button with the correct parameters, the following screen with database tables and users will be displayed:

With this tool, entries in the rb_user table and the rb_comment table can be visualized for ease of development.