For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Spring Boot and Spring Data JPA Integration

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.

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 tutorial.

Learn how to set connection, naming, and JPA properties, customize the MongoClient, and interpret startup errors in the Configure the Spring Boot Starter guide.