Spring Data JPA and H2

Spring Data

Spring Data makes persistence much easier. I personally not a huge fan of JPA and ORMs.  However, I know lots of engineers like it and I respect different preferences. Have different preferences in different services is totally fine. However, doing that in shared libs is NO-NO. Today I want to cover a bit more about how we can use Spring Data JPA and H2 database for testing. Speed matters. Combining H2 and MockMVC we can speed up tests considerably. I made a simple POC showing how we can configure and use Spring Data JPA with H2 and do proper testing using MockMVC capabilities. I also show how to use the H2 Console so we can query the database. Spring-Data makes persistence much more concise and leverages lots of common functionality for us. So Let's get started. 



The Video

The Code

https://github.com/diegopacheco/java-pocs/tree/master/pocs/spring-boot-2x-data-jpa-h2

Cheers,

Diego Pacheco

Popular posts from this blog

Java Agents

Manage Work not People

DDD The Lost Discipline