JDBC, Transactions, Spring Data JPA
July 31, 2021

M03 Q24 What do you have to configure to use JPA with Spring? How does Spring Boot make this easier?

Following steps are required to work with JPA in Spring Framework:

Spring Boot simplifies JPA setup by:

  • Providing spring-boot-starter-data-jpa dependency which includes all required dependencies
  • Providing auto-configuration for JPA
  • Automatically defines PlatformTransactionManager, EntityManager and other required beans
  • Allows Data Source to be configured via properties
  • Provides out-of-the-box support for Hikari Connection Pool
  • Provides default properties to JPA
  • Automatically creates DAO beans for Repositories