Setting up a Spring-MongoDB project
We need to create a simple web application project using Maven.
- Execute the following command in your Maven command prompt:
mvn archetype:generate -DgroupId=com.packtpub.spring -DartifactId=spring-mongo -DarchetypeArtifactId=maven-archetype-webapp
- Create a simple Maven project with a web application archetype. Add the latest
4.0.2.RELEASE
spring dependency. - The following is an extract from the
pom.xml
file. These are the mandatory dependencies to be added to thepom.xml
file.<!-- Spring dependencies --> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongo-java-driver</artifactId> <version>2.9.1</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-mongodb</artifactId> ...
Get Mastering Spring Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.