
- Spring Boot & H2 - Home
- Spring Boot & H2 - Overview
- Spring Boot & H2 - Environment Setup
- Spring Boot & H2 - Project Setup
- Spring Boot & H2 - REST APIs
- Spring Boot & H2 - H2 Console
- Spring Boot & H2 Examples
- Spring Boot & H2 - Add Record
- Spring Boot & H2 - Get Record
- Spring Boot & H2 - Get All Records
- Spring Boot & H2 - Update Record
- Spring Boot & H2 - Delete Record
- Spring Boot & H2 - Unit Test Controller
- Spring Boot & H2 - Unit Test Service
- Spring Boot & H2 - Unit Test Repository
- Spring Boot & H2 Useful Resources
- Spring Boot & H2 - Quick Guide
- Spring Boot & H2 - Useful Resources
- Spring Boot & H2 - Discussion
Spring Boot & H2 - Console
As in previous chapter Application Setup, we've created the required files in spring boot project. Now let's update the application.properties lying in src/main/resources and pom.xml to use a different version of maven-resources-plugin.
application.properties
spring.datasource.url=jdbc:h2:mem:testdb
pom.xml
... <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> </plugin> </plugins> </build> ...
Run the application
In eclipse, run the Employee Application configuration as prepared during Application Setup
Eclipse console will show the similar output.
[INFO] Scanning for projects... [INFO] [INFO] [1m------------------< [0;36mcom.tutorialspoint:springboot-h2[0;1m >------------------[m [INFO] [1mBuilding springboot-h2 0.0.1-SNAPSHOT[m [INFO] from pom.xml [INFO] [1m--------------------------------[ jar ]---------------------------------[m ... [INFO] [1m--- [0;32mspring-boot:3.3.2:run[m [1m(default-cli)[m @ [36mspringboot-h2[0;1m ---[m [INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-buildpack-platform/3.3.2/spring-boot-buildpack-platform-3.3.2.pom ... [INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-collections4/4.4/commons-collections4-4.4.jar (752 kB at 603 kB/s) [INFO] Attaching agents: [] . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v3.3.2) 2024-08-20T16:21:53.752+05:30 INFO 15660 --- [springboot-h2] [ restartedMain] c.t.s.SpringbootH2Application : Starting SpringbootH2Application using Java 21.0.2 with PID 15660 (E:\Dev\springboot-h2\target\classes started by Tutorialspoint in E:\Dev\springboot-h2) ... 2024-08-20T16:21:57.864+05:30 INFO 15660 --- [springboot-h2] [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2024-08-20T16:21:57.899+05:30 INFO 15660 --- [springboot-h2] [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/' 2024-08-20T16:21:57.907+05:30 INFO 15660 --- [springboot-h2] [ restartedMain] c.t.s.SpringbootH2Application : Started SpringbootH2Application in 4.738 seconds (process running for 5.305)
Once server is up and running, open localhost:8080/h2-console in a browser and click on Test Connection to verify the database connection.

Click on Connect button and H2 database window will appear as shown below −

Advertisements