Giter Site home page Giter Site logo

vinimrs / spring-boot-clean-architecture Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 21.0 950 KB

An analysis of a clean architecture implementation in a spring boot application.

Java 100.00%
case-study clean-architecture java software-architecture spring-boot webdevelopment

spring-boot-clean-architecture's Introduction

Clean Architecture with Spring Boot

An analysis of a clean architecture implementation in a spring boot application. Checking the results of the merge of this two architectures. Comparing the code metrics of Spring Boot classical architecture and the result of the clean architecture applied to it.

The target application

Project to implement a web application of a system for online bike rentals using the technologies Java Spring Boot for the development of a API REST, in order to contemplate the main responsibilities of a bicycle rental exploring and knowing better how the development of web systems works.

Collection of requests for the API - Postman

Features

This system was based on the requirements document proposed by the professor during the course.

  • Feature 1 Users management: The system allows a super user (administrator) to manage (CRUD) all users of the system, such as rental companies and customers.
  • Feature 2 Bikes rental: The system allows customers to rent bicycles at a certain date from rentesCompanies available in the system.
  • Feature 3 Browsing without login: The system provides interfaces for non-logged in users to be able to use the system without a registration.
  • And more....

Technologies

Common Spring Boot Architecture

The common architecture is an simple one, based on layers that communicate with a certain hierarchy between them, as can be seen below.

Common spring boot architecture

The central idea is that it will have well-defined layers with vertical boundaries. But this idea is not being followed properly. In reality, some cyclic dependencies occur between layers, because many responsibilities are not well separated, making the code more coupled.

Layers depend on others in a partial hierarchy and all layers depend on the structure code. And this can be negative for a few reasons:

  1. The main rules of the domain are mixed with the details of the framework;
  2. The code complexity of domain rules increases;
  3. Changes to the structure directly affect the application code.

The application implemented is the [common project].

Simplified Spring Boot Architecture with Clean Architecture

Trying to improve code organization, the clean architecture is a good start with that rules. We can arrive in an well-defined vertial boundaries, with a rigid hierarchy between the layers, the rules of the domain code is encapsulated of the framework code, and basically the code of the inner layers.

Spring boot architecture with clean arhcitecture

The resulting architecture proposed for the application of Clean Architecture will contain 3 layers, they are: Infraestructure, Use case and Entity. In which follows a rigid hierarchy between the layers - the codes of the innermost layers do not know those of the outermost.

This architecture implemented is in the [simplified project].

spring-boot-clean-architecture's People

Contributors

vinimrs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.