Skip to content

middlewaregruppen/spring-boot-demo-api

Repository files navigation

CI Conventional Commits Release Please

Demo Spring Boot API

Simple containerized spring boot API with test coverage that can be used for test purposes in CI/CD pipelines.

🐳 Latest Docker Image

# Latest from main branch
ghcr.io/middlewaregruppen/spring-boot-demo-api:main

# Latest Release
ghcr.io/middlewaregruppen/spring-boot-demo-api:1.0.0

Pull command:

docker pull ghcr.io/middlewaregruppen/spring-boot-demo-api:1.0.0

Requirements

  • Java JDK 17
  • Maven 3.6.0
  • VSCode or other IDE

Building the jar

From the project root, after making sure you have Java 17 in the path

mvn clean package

Creating the Docker image

From the project root

export DOCKERHUB_USER=yourdockeruser
docker build -t $DOCKERHUB_USER/spring-boot-demo-api .

Push the image to your repo

docker push -t $DOCKERHUB_USER/spring-boot-demo-api .

Note: You will need to update this in deployment files also to reference the correct user

Using the demo

This app exposes a simple /greeting endpoint under

http://app.domain.com/greeting

and

http://app.domain.com/greeting?name=Charlie

Calls to the endpoint increment a counter that can be monitored using prometheus.

Metrics

Added a @Timer metric on the greeting method and also a custom Counter metric to track the number of times the greeting is called.

Metrics can be looked up via

http://localhost:8080/actuator/prometheus

About

Simple containerized spring boot API for testing

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors