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, we can apply these techniques in conjunction with the hexagonal architecture.
So, in this chapter, we will learn how to combine the JPMS with the hexagonal architecture to create a well-encapsulated system with clearly defined...