Implementing Spring Data with JPA
Spring Boot 2.0 still supports persistence using JPA, which avoids too many SQL scripts and Hibernate configurations. It provides auto-configuration when it comes to creating a persistence layer and, thus, it is an option to auto-configure the hibernate.properties
and some JPA details. This recipe will illustrate how reactive applications can integrate with a non-reactive Spring Data JPA for MySQL CRUD transactions.
Getting started
Open ch09-flux
and add a Spring Data JPA module for persistence and transaction management.
How to do it...
Spring 5 still supports Spring Data modules including Spring Data JPA. This recipe will showcase how to integrate Spring Data JPA using Spring Boot 2.0:
- First, add the following starter POM dependency for Spring Data JPA auto-configuration:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency>
- Inside the package...