Skip to content

paul-pop/java-spring-service

Repository files navigation

Java Spring Service

CircleCI codecov Codacy Badge

This is a skeleton service that uses Java 8 and Spring Boot. It contains the following:

  • Maven for dependency management
  • JUnit and Spring Test for unit and integration testing
  • Spring profiles for multi-environment setup
  • EditorConfig for code formatting
  • Jacoco for coverage (must be > 80%)
  • Swagger for API docs
  • Access logger for HTTP logs
  • Spring Actuator for monitoring and healthcheck
  • Spring Security for securing the Actuator endpoints
  • Lombok for amazing POJOs
  • Dockerfile and Docker Compose to run the service

Prerequisites

In order to build the project, you will have to install the following:

Build

Maven

mvn clean install

Docker

docker build -t quay.io/paulpop/java-spring-service .

Run

Maven

mvn spring-boot:run

Docker

Environment variables:

  • ENVIRONMENT = Spring Profile to use for configurations default, dev or prod (required)
  • ADMIN_PASSWORD = Spring Actuator admin password
docker-compose up --build

If you need to change any of the environment variables, please use the .env file.

Configuration

Configuration file 'application.yml' is present in config directory together with profile specific YML files. The application.yml is used as a parent and the profile specific ones are used for overrides.

Testing

To run the unit and integration tests, execute:

mvn verify

To run the unit tests only, execute:

mvn verify -DskipITs

To run the integration tests only, execute:

mvn verify -DskipUTs

Documentation

Once you run the application, the documentation of the API can be found at: http://localhost:8080/swagger-ui.html

About

Java Skeleton for services built with Spring Boot

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages