Summary
In this chapter, we started by looking into the motivations and benefits behind the JPMS. We discovered that one of the problems the JPMS solves is that of JAR hell, where it’s difficult to control the dependencies that an application should expose and use. The JPMS addresses this problem by closing access to every public type in a module, requiring the developer to explicitly state which packages containing public types should be visible to other modules. Also, the developer should state the modules that a given module depends on in the module
descriptor.
Next, we discussed the DIP and recognized the use cases, input ports, input adapters, and output adapters as components that we can apply to the DIP. Then, we used JPMS features such as consumers, services, and providers to refactor the topology and inventory system to enable dependency inversion in conjunction with hexagonal architecture components.
By employing the DIP, we created a more supple design, an important...