Driky / spring-boot-clean-architecture-demo

An example of clean architecture implementation with Spring Boot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spring-boot-clean-architecture-demo

Build Status

An example of clean architecture with Spring Boot

Foreword

This application is designed using a Clean Architecture pattern (also known as Hexagonal Architecture). Therefore SOLID principles are used in code, especially the Dependency Inversion Principle (do not mix up with the classic dependency injection in Spring for example).

Concretely, there are 3 main packages: domain, use_cases and infrastructure. These packages have to respect these rules:

  • domain contains the business code and its logic, and has no outward dependency: nor on frameworks (Hibernate for example), nor on use_cases or infrastructure packages.
  • use_cases is like a conductor. It will depend only on domain package to execute business logic. use_cases should not have any dependencies on infrastructure.
  • infrastructure contains all the technical details, configuration, implementations (database, web services, etc.), and must not contain any business logic. infrastructure has dependencies on domain, use_cases and frameworks.

Install

./gradlew assemble

Test

./gradlew check

Mutation testing

./gradlew pitest

Run

./gradlew bootRun

About

An example of clean architecture implementation with Spring Boot


Languages

Language:Java 93.1%Language:Shell 6.9%