© Alexandru Jecan  2017

Alexandru Jecan, Java 9 Modularity Revealed, https://doi.org/10.1007/978-1-4842-2713-8_6

6. Services

Alexandru Jecan

(1)Munich, Germany

A service is basically a piece of functionality defined by an interface or a class for which service providers exist. The role of services is to decouple tightly coupled modules and to allow loose coupling between service providers and service consumers. Using services in JDK 9 isn’t mandatory, but they offer a nice solution for having decoupled modules.

Suppose we want to test the brake systems for different types of cars. A brake service could define general guidelines, legal rules, and best practices for testing the brake systems. The car manufacturers could implement their own services ...

Get Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.