Part X — Modularity and Services

Design loosely coupled systems with JPMS service discovery and dynamic module composition.

What You'll Learn

Build scalable, modular architectures with the Java Platform Module System (JPMS). Implement service-oriented designs using ServiceLoader for runtime polymorphism, use module layers for dynamic module loading and unloading, and navigate safe migration strategies when integrating automatic modules.

Chapters in This Part

Chapter 33. ServiceLoader

Implement the service provider pattern with ServiceLoader for decoupled, discoverable implementations. Learn how to define services, implement providers, and use service discovery in plugin architectures and microservice communication.

Chapter 34. Module Layers

Create module layers for dynamic loading scenarios—essential for polyglot applications, plugin systems, and testing frameworks. Understand parent-child layer relationships, visibility rules, and the full lifecycle of dynamically loaded modules.

Chapter 35. Migration and Compatibility

Navigate the pragmatic path to modularity. Learn about the unnamed module, automatic modules, and safe migration strategies that let you adopt JPMS incrementally without disrupting existing codebases.