Compose Java services with the module system

8 steps · about 2 h 36 min · Intermediate

  1. Understand what a named module changes (tutorial, Dev.java, 24 min)

    The official tutorial frames readability, exports and strong encapsulation before code is split.

  2. Inspect modules at runtime (reference, Oracle Java documentation, 14 min)

    The Module API makes the resolved runtime model concrete and inspectable.

  3. Compile a multi-module source tree (guide, Oracle Java documentation, 22 min)

    The compiler's module-source-path rules determine whether the source layout is reproducible.

  4. Inspect the module artifact format (guide, Oracle Java documentation, 16 min)

    The jmod tool makes the contents and boundaries of a platform module artifact concrete.

  5. Define and discover a service provider (reference, Oracle Java documentation, 22 min)

    ServiceLoader connects an interface to implementations without exporting their internals.

  6. Audit dependencies and accidental internals (guide, Oracle Java documentation, 18 min)

    jdeps reveals missing module declarations and reliance on unsupported JDK internals.

  7. Package modular JAR files (guide, Oracle Java documentation, 16 min)

    A deliberate archive layout preserves descriptors and gives each module a stable artifact.

  8. Build and verify a custom runtime (guide, Oracle Java documentation, 24 min)

    jlink is the final proof that the resolved module graph contains everything the application needs.