Skip to content

middlewaregruppen/spring-boot-demo-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo Spring Boot API

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

Requirements

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

Building the jar

From the project root, after making sure you have Java 11 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 4

  •  
  •  
  •  
  •