Modern architectural styles like “hexagonal,” “clean,” and “onion” all share a straightforward principle: business logic should sit at the center of your software, free of frameworks, databases, user interfaces, and external services. The tricky bit comes when you start putting these ideas into practice when you’re refactoring a legacy enterprise mudball, implementing microservices, or building a “modulith” in Spring. Clean Applications with Hexagonal Architecture: Building maintainable microservices and modular monoliths guides you from the hexagonal architecture at the core of modern enterprise software to its practical implementation with examples in Java and Spring Boot.
If you’ve ever stared at a class and asked “where does this code belong?” this book ends the guesswork. Author Enrique Medina Montenegro shows you how to take advantage of an architecture that gives every class exactly one reason to exist and one place to live. Following the principles of hexagonal architecture, you’ll build a running example application outward from the domain core. Each chapter adds a new layer, until the architecture enforces itself through executable specifications.
The book begins with the pain points that push teams toward clean architecture. Then, it introduces the hexagon and the dependency inversion mechanics behind it. Next, you’ll learn to handle input ports, an orchestrating application layer, a domain layer with enforced invariants, and output ports to infrastructure. Finally, you’ll assemble the full structure, then lock it down with ArchUnit rules (including freeze for legacy adoption) and mechanical unit testing recipes. In part two, you’ll extend this foundation into modular monoliths and microservice extraction.
By the time you’re done reading, you’ll have built a complete hexagonal application from the domain core outward, and gained the discipline to apply the same patterns to any codebase you touch next. You’ll know exactly where every class belongs, why every dependency points inward, and how to write tests that stay green when infrastructure changes. Most importantly, you’ll have the confidence to push back on tangled dependencies, leaky abstractions, and framework lock-in, because you’ll have seen what clean architecture looks like when it’s done right.