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 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 { } ...