Skip to content

step-beyond/spring-boot-examples

Repository files navigation

Spring Boot Example Repository

Quality Gate Status Coverage Java CI

This repository contains a bunch of examples of how to deal with common technical challenges, which developers face frequently, when implementing services with SpringBoot.

The project structure is oriented to domain driven design (DDD) and clean architecture. However, the primary purpose of this repository is to serve continuing education, and therefore the architectural concepts are not consistently followed.

Tools, Frameworks & Conventions

Spring

HTTP Clients

REST Clients

Messaging

Testing Tools

Unit Tests

Unit Tests follow the naming pattern "Test".

  • JUnit5
  • AssertJ
    • used to write fluent assertions
    • Example
    • Example for soft assertions. Soft assertions are useful, when multiple assertions are examined in one test. With soft assertions you can disable the default fail fast behavior.
  • Mockito
    • used to mock dependencies to other services
    • Example

Integration Tests

Integration Tests follow the naming pattern "IT". An integration test scenario is created with tools, which can be easily integrated into JUnit & SpringBoot.

  • WireMock
    • used to test outgoing http requests
    • Example
  • Testcontainers
    • used to start any type of external services, i.e. databases or message queues.
    • Example
  • Awaitility
    • used to ensure a given state after a given time. Practical especially for asynchronous communications.
    • Example

Architectural Tests

Deployment Tools

  • jib
    • used to build an image without a Docker daemon
    • Example
  • Docker Compose
    • used to start the service together with the surrounding infrastructure, i.e. message broker, databases, etc.
    • Example
  • Semantic Release
    • used to create releases based on semantic versioning. With the conventional commits, the proper release version (MAJOR.MINOR.PATCH) will be resolved.

Conventions