How to use mongoDB with spring boot?

12th Oct 2022, 12:33 AM
Riju - avatar
2 Answers
+ 2
You can use this pre-initialized project and click Generate to download a ZIP file. This project is configured to fit the examples in this tutorial. To manually initialize the project: Navigate to https://start.spring.io. This service pulls in all the dependencies you need for an application and does most of the setup for you. Choose either Gradle or Maven and the language you want to use. This guide assumes that you chose Java. Click Dependencies and select Spring Data MongoDB. Click Generate. Download the resulting ZIP file, which is an archive of a web application that is configured with your choices. Greetings, J Wick
12th Oct 2022, 5:49 AM
Jimmy Wick
Jimmy Wick - avatar
+ 1
You need to include a mongo dependency in your pom.xml file. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> Credits:- https://www.mongodb.com/compatibility/spring-boot
12th Oct 2022, 2:52 AM