Code Monkey home page Code Monkey logo

spring-data-mongodb-demo's Introduction

spring-data-mongodb-demo

Spring Boot Application using Spring Data and MongoDB

This application helps you to integrate your spring boot application with MongoDB

Pre-requisites:

Up and running instance of MongoDb. If you do not have MongoDB installed on your machine please follow the link https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/. This link provides step by step installation guide.

Start the Mongodb database:

Go to the location where mongodb data/db folder is created.In my system the location is /Users/vinayanayak/data-mongodb/mongodb/data/db and start the service

mongod --dbpath=.

Build the service:

mvn clean install

Once the build is successful you can notice the query classes for your pojos.For example for Hotel.java you can observe that QHotel.java is generated under target/generated-sources/annotations directory

Start the service:

mvn spring-boot:run

REST Endpoints:

GET http://localhost:8085/hotels/all

PUT http://localhost:8085/hotels

POST http://localhost:8085/hotels

DELETE http://localhost:8085/hotels

GET http://localhost:8085/hotels/{id}

GET http://localhost:8085/hotels/price/{maxPrice}

GET http://localhost:8085/hotels/address/city

Find all the Hotels in a country:

http://localhost:8085/hotels/address/country/{country}

Find all the Hotels with maximum priceperNight is 150 and having atleast one rating greater than 5:

GET http://localhost:8085/hotels/recommended

Swagger-UI:

ALl the api end-points can be accessed via swagger-ui once the application comes up

. Swagger-ui Url:

http://localhost:8091/swagger-ui.html

. Api docs:

http://localhost:8091/v2/api-docs

spring-data-mongodb-demo's People

Contributors

vinayanayak88 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.