9

Applying Dependency Inversion with Java Modules

In the previous chapters, we learned how to develop each hexagon as a Java module. By doing that, we started to enforce the scope and responsibilities of each hexagon in the architecture. However, we did not go too far in exploiting the Java module’s features, such as encapsulation and dependency inversion, and how these features can enhance the overall structure of a hexagonal system by making it more robust and loosely coupled.

To understand the role that’s played by the Java Platform Module System (JPMS) in developing a hexagonal system, we need to understand what problems the JPMS aims to solve. Once we know what we can do with the JPMS in terms of encapsulation and dependency inversion, ...

Get Designing Hexagonal Architecture with Java - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.