Skip to content

beemi/spring-boot-mongodb-example

Repository files navigation

spring-boot-mongodb-example

Docker Image CI

Spring boot service with mongoDB CRUD example

Description

This is a simple example of a Spring boot service with mongoDB CRUD.

Development

Start MongoDB, Prometheus, Grafana, and the service with the following commands:

docker-compose up -d

Alt text

Connect MongoDB using Compass The GUI for MongoDB:

Alt text

Stop the service with the following command:

docker-compose down

Running MongoDB as a Docker Container

You can start a MongoDB container using Docker with the following command:

docker run -d -p 27017:27017 --name mongodb mongo

Gradle build

gradle bootRun

Access actuator

http://localhost:8080/actuator

http://localhost:8080/actuator/health

Swagger UI

http://localhost:8090/api-docs/

http://localhost:8090/swagger-ui/index.html

Alt text

Prometheus (Monitoring)

http://localhost:8080/actuator/prometheus

Alt text

Check Prometheus scraping metrics:

Raw metrics: http://localhost:9090/metrics

Alt text

http://localhost:9090/graph

Alt text Alt text

Contacts

Owner: beemi.raja@gmail.com