Spring Boot and Spring Data JPA Integration

For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

Spring Boot and Spring Data JPA Integration

Overview

The MongoDB Extension for Hibernate ORM provides a Spring Boot starter that lets a Spring Boot application persist JPA entities to MongoDB. When you activate the starter, it configures the following components for you:

  • A JPA EntityManagerFactory backed by MongoDB

  • A JpaTransactionManager

  • Spring Data JPA repository support

The starter reuses the MongoClient that Spring Boot's MongoDB support creates, so your application maintains a single connection pool.

The Spring Boot starter is not Spring Data MongoDB, and you can use it without adding a SQL DataSource to your application.

Get Started

Learn how to create a Spring Boot application that uses the starter to read and write MongoDB data in the [Get Started with the Spring Boot Starter](https://www.mongodb.com/docs/languages/java/mongodb-hibernate/current/spring-boot/get-started.md#std-label-hibernate-spring-boot-get-started tutorial.

Configure the Starter

Learn how to set connection, naming, and JPA properties, customize the MongoClient, and interpret startup errors in the [Configure the Spring Boot Starter](https://www.mongodb.com/docs/languages/java/mongodb-hibernate/current/spring-boot/configure.md#std-label-hibernate-spring-boot-configure guide.