Java 9 Dependency Injection
上QQ阅读APP看书,第一时间看更新

Java Platform Module System

The introduction of Java Platform Module System (JPMS) is key and a game changer feature of Java 9 and JPMS developed under the shed of project Jigsaw.

The main objectives of project Jigsaw are as follows:

  • Scalable JDK: Until Java 8, engineering of JDK is solid and contains a number of components, which make it troublesome to maintain and develop. JDK 9 is partitioned into sets of independent modules, which permits custom runtime capability to incorporate only required modules in our application, which offers assistance to diminish runtime size.
  • Robust encapsulation and security: Bundles from the module can be expressly exposed if required by other modules. On the other hand, another module has to explicitly define which particular bundles are required from modules. This way, modules can encapsulate particular bundles for security purposes.
  • Dependency: Modern module frameworks permit us to define unequivocal dependency between modules and all required subset modules dependency can be distinguished at compile time.
  • Modern rebuild permits us to incorporate runtime images of modules, which gives superior performance of JDK. It moreover evacuates tools.jar and rt.jar from runtime images.
  • To secure the internal structure of runtime images, an unused URI conspire is utilized for naming modules, resources, and classes.

We will discuss JPMS in detail in the Modular Framework in Java 9 section.