Spring boot with embedded PostgreSQL for DAO integration/unit testing and local development

Mahmoud Romeh
Sep 6, 2018 · 1 min read

In this small post, we will go through how to use embedded PostgreSQL in your local development environment plus how to use it for DAO integration/unit testing. If you have and are using PostgreSQL as your production database, your DAO testing should use the same database as your production one in order to have behavior consistency and the same environment precondition.

We will go through a sample Spring Boot application:

  1. The Spring Boot application dependencies
  2. DB configuration with embedded PostgreSQL for development
  3. Customer CRUD different layers with spring data, mapstruct, and lombok
  4. DAO unit testing with embedded PostgreSQL with custom data population on start

The whole details of the above points are covered in my blog post :https://mromeh.com/2018/09/03/spring-boot-with-embedded-postgresql-for-dao-integration-unit-testing-and-local-development/

Mahmoud Romeh

A Geek who code for fun and screw people lifes with the results :)

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade