The service registry
In order to cross this bridge between the consumer and the implementation without direct tight coupling, imagine a layer between them called the service registry. The service registry is a layer provided by the module system to record and register implementations of a given interface as services. Think of it as a kind of phone book or yellow pages, but for services. Any module that implements a service needs to register itself in the service registry. Once that's done, the service registry has all the information about the different service implementations of the interface that are available. The following diagram illustrates this interaction:
Now when the consumer needs an implementation, it uses the services API to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access