Skip to content

Example implementation of a microservice based on an Open API spec and the java-microservice-template

License

Notifications You must be signed in to change notification settings

nimble-platform/java-microservice-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microservice Example using Java 8

ServiceID: java-microservice-example

Example implementation for a microservice written in Java and the Spring Boot framework.

Configuration

Base configuration can be found at src/main/resources/application.properties and bootstrap.yml. Spring Cloud Config is used for central configuration management. A central configuration is hosted on https://github.com/nimble-platform/cloud-config and injected during startup.

Swagger

The Example API is designed using the swagger.io editor (file: src/main/resources/api.yml) and the code generator for the Spring framework. The Maven plugin (swagger-codegen-maven-plugin) is used to generate defined interfaces automatically in each Maven build.

How-to

Service build and startup

# standalone
mvn clean spring-boot:run

# in docker environment from core cloud infrastructure using 8085 as internal port
mvn clean package docker:build -P docker
docker run -p 8081:8085 nimbleplatform/java-microservice-example

The according Dockerfile can be found at src/main/docker/Dockerfile.

Example requests

# get
curl http://localhost:8081/example

# post
curl -H "Content-Type: application/json" -d '{"prop1":"Jorge Lorenzo","prop2":99}' http://localhost:8081/example

The project leading to this application has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 723810.

About

Example implementation of a microservice based on an Open API spec and the java-microservice-template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published