Spring Boot Application using Spring Data and MongoDB
This application helps you to integrate your spring boot application with MongoDB
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.
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=.
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
mvn spring-boot:run
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
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: