- 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 Tutorial
What is Spring Boot?
Spring Boot provides a intrinsic support for an in memory database, H2 and is minimal in configurations. Developers can quickly start a application with CRUD capabilities within a hour.
What is H2?
H2 database is an open source, embedded and in memory relational database management system. It is written in Java and provides a client/server application. It stores data in system memory instead of disk. Once program is closed, data is also lost. An in memory database is used when we don't want to persist the data and unit test the overall functionality. Some of the other popular in memory databases are HSQLDB or HyperSQL Database and Apache Derby. H2 is the most popular one among other embedded databases.
This Spring Boot & H2 tutorial is based on the latest Spring Boot 3.5.6 Version.
Advantages of H2 Database
Following is the list of advantages that H2 provides −
No configuration − Spring Boot intrinsically supports H2 and no extra configuration required to configure H2 database.
Easy to Use − H2 Database is very easy to use.
Lightweight and Fast − H2 database is very lightweight and being in memory, it is very fast.
Switch configurations − Using profiles, you can easily switch between production level database and in-memory database.
Supports Standard SQL and JDBC − H2 database supports almost all the features of Standard SQL and operations of JDBC.
Web Based Console − H2 Database can be managed by its web based console application.
Who Should Learn Spring Boot & H2?
This Spring Boot & H2 tutorial is designed for Java developers to understand and develop production−ready spring applications with minimum configurations. It explores major features of Spring Boot such as Starters, Auto−configuration, Beans, Actuator and more. By the end of this tutorial, you will gain an intermediate level of expertise in Spring Boot.
Prerequisites to Learn Spring Boot & H2?
This Spring Boot & H2 tutorial is written for readers who have a prior experience of Java, Spring, Maven, or Gradle. You can easily understand the concepts of Spring Boot if you have knowledge on these concepts. It would be an additional advantage if you have an idea about writing a RESTful Web Service interacting with database. If you are a beginner, we suggest you to go through tutorials related to these concepts before you start with Spring Boot.