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:

  1. 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> 
  1. Inside the package org.packt.spring.boot.config, create a non-webflux @Configuration to enable JPA transaction management. Spring Data JPA is not a reactive dependency, so avoid applying an @EnableWebFlux annotation:
@Configuration @EnableJpaRepositories(basePackages="org.packt.spring.boot.dao") @EnableTransactionManagement public class SpringDataConfig { }  ...

Get Spring 5.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.