How to create the best MongoDB configuration with spring

Objective:

This blog is to give an insight to create the NoSQL DB configuration using spring and maven.

Pre-requisite:

To create MongoDB/NoSQL configuration, following are required.

  • Running MongoDB/NoSQL DB, could be protected by user name and password
  • Maven dependencies

Maven Dependency

To create configuration following dependencies are required.

Here, I chose MongoDB as NoSQL DB therefore I used mongo driver. If you want to use other NoSQL DB then add DB specific driver dependency.

Application.properties file

Add database information into this file as given below:

NoSQL/MongoDB Configuration

 

To load all the repository classes I have added a marker interface in repository folder where all the repository present.

Now, this configuration has integrated with spring using spaing-data, mongodb driver.
If you face any difficulty to configure then leave a comment to help you out.

Git Source:
Visit git source code

share or like this post
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Share