Clean Architecture Example with Java and Spring Boot

Juan Manuel Lopez
The Startup
Published in
7 min readApr 6, 2020

--

Creating an application is easy, just sit to code and … habemus application. If you are stuck, just go to the Internet, search, and you are going to find tons of samples, frameworks, templates, that will help you with your application.But creating a Great, Production-Ready Application is a whole different story.

The idea of Clean Architecture is to put delivery and gateway at the edges of our design. Business logic should not depend on whether we expose a REST or a GraphQL API, and it should not depend on where we get data from — a database, a microservice API exposed via gRPC or REST, or just a simple CSV file.

The pattern allows us to isolate the core logic of our application from outside concerns. Having our core logic isolated means we can easily change data source details without a significant impact or major code rewrites to the codebase.

One of the main advantages we also saw in having an app with clear boundaries is our testing strategy — the majority of our tests can verify our business logic without relying on protocols that can easily change.

Components

I wanted to give a more pragmatic/simplistic approach that can help in the first incursion to the clean architecture. That’s why I’ll be omitting concepts that may feel unavoidable to…

--

--

Juan Manuel Lopez
The Startup

Technical Manager at NTTData — Leading teams to exceptional results through cutting-edge programming practices - 15+ years of expertise in software engineering.