CRUD application with Spring Boot 2.2, Java 11 and H2

Last Updated:  January 18, 2020 | Published: June 1, 2019

Today I want to share with you my first YouTube series about CRUD application with Spring Boot 2.2, Java 11 and H2. This series contains five YouTube videos and will use the latest Spring Boot version, Java 11 and H2 as an embedded database.

You'll learn how to effectively write and test CRUD (Create, Read, Update, Delete) applications using Spring Boot. The application is developed in a TDD style (Test-Driven-Development) with JUnit 5.

If you are new to the Spring Framework, this might be a good start for you, but I'm also providing some nice tips & tricks for a more experienced developer. Give it a try!

Part I: Basic Spring Boot application setup

First, I'm covering how to set up everything:

  • basic application setup with Maven
  • configure Hibernate to create the database schema for the H2 database
  • model the JPA entity
  • populate random data

CRUD Part II: Creating entities with Spring Boot

Next, the first CRUD section starts with creating entities:

  • creating new entities with an HTTP POST request
  • persisting the entity in the database
  • returning the URL to new resources in the HTTP Location header.

CRUD Part III: Reading entities

Thirdly, I'm covering how to read entities:

  • accessing all entities available
  • accessing a single entity identified by its id
  • handle the error case if no entity is present in the database for the requested id

CRUD Part IV: Updating entities

Furthermore, you'll learn how to update entities in this section:

  • update already existing entities with an HTTP PUT request
  • handle the error case if the requested entity is not present
  • update the entity in the database

CRUD Part V: Deleting entities

Finally, this section covers how to delete entities:

  • deleting database entities with an HTTP DELETE request

In conclusion, this free series gives you a great introduction to creating CRUD applications. Moreover, I'm sharing the best practices and include Test-Driven Development practices. You can find the whole codebase on GitHub.

For further resources as a Spring developer, have a look at the Essential Spring Developer Resources.

Have fun writing CRUD applications,

Philip

>