Testing Spring Data JPA with @DataJpaTest

This article shows how to use @DataJpaTest to test the Spring Data JPA application. Technologies used: Spring Boot 3.1.2 Spring Data JPA (Hibernate 6 is the default JPA implementation) H2 in-memory database Maven Java 17 JUnit 5 Table of contents: 1. Project Directory 2. Spring Data JPA – Entity and Repository 3. @DataJpaTest 3.1 Disable …

Read more

Spring REST + Spring Security Example

In this article, we will enhance the previous Spring REST Validation Example, by adding Spring Security to perform authentication and authorization for the requested URLs (REST API endpoints) Technologies used : Spring Boot 2.1.2.RELEASE Spring 5.1.4.RELEASE Spring Security 5.1.3.RELEASE Spring Data JPA 2.1.4.RELEASE H2 In-memory Database 1.4.197 Tomcat Embed 9.0.14 JUnit 4.12 Maven 3 Java …

Read more

Spring REST Hello World Example

In this article, we will show you how to develop a Spring Boot REST style web service to handle CRUD operations from a H2 In-memory database. Technologies used : Spring Boot 2.1.2.RELEASE Spring 5.1.4.RELEASE Spring Data JPA 2.1.4.RELEASE H2 In-memory Database 1.4.197 Tomcat Embed 9.0.14 JUnit 4.12 Maven 3 Java 8 1. Project Directory 2. …

Read more