Spring Boot & H2 Tutorial
Selected Reading
- Spring Boot & H2 - Discussion
- Spring Boot & H2 - Useful Resources
- Spring Boot & H2 - Quick Guide
- Spring Boot & H2 - Unit Test Repository
- Spring Boot & H2 - Unit Test Service
- Spring Boot & H2 - Unit Test Controller
- Spring Boot & H2 - Delete Record
- Spring Boot & H2 - Update Record
- Spring Boot & H2 - Get All Records
- Spring Boot & H2 - Get Record
- Spring Boot & H2 - Add Record
- Spring Boot & H2 - H2 Console
- Spring Boot & H2 - REST APIs
- Spring Boot & H2 - Project Setup
- Spring Boot & H2 - Environment Setup
- Spring Boot & H2 - Overview
- Spring Boot & H2 - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Spring Boot & H2 - H2 Console
Spring Boot & H2 - Console
As in previous chapter
, we ve created the required files in spring boot project. Now let s update the apppcation.properties lying in src/main/resources and pom.xml to use a different version of maven-resources-plugin.apppcation.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> <version>3.1.0</version> </plugin> </plugins> </build> ...
Run the apppcation
In ecppse, run the Employee Apppcation configuration as prepared during
Ecppse console will show the similar output.
[INFO] Scanning for projects... [INFO] [INFO] -----------------< com.tutorialspoint:sprint-boot-h2 >------------------ [INFO] Building sprint-boot-h2 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- ... . ____ _ __ _ _ /\ / ___ _ __ _ _(_)_ __ __ _ ( ( )\___ | _ | _| | _ / _` | \/ ___)| |_)| | | | | || (_| | ) ) ) ) |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.5.2) ... 2021-07-24 20:51:11.347 INFO 9760 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initiapzed with port(s): 8080 (http) ... 2021-07-24 20:51:11.840 INFO 9760 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at /h2-console . Database available at jdbc:h2:mem:testdb ... 2021-07-24 20:51:14.805 INFO 9760 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path 2021-07-24 20:51:14.823 INFO 9760 --- [ restartedMain] c.t.s.SprintBootH2Apppcation : Started SprintBootH2Apppcation in 7.353 seconds (JVM running for 8.397)
Once server is up and running, open localhost:8080/h2-console in a browser and cpck on Test Connection to verify the database connection.
Cpck on Connect button and H2 database window will appear as shown below −
Advertisements