O'Reilly logo

Modular Programming in Java 9 by Koushik Kothagal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and using services

Here are the end-to-end steps to create, register, and implement a service:

  1. Create the Java type that defines the service: Every service is based off of a single Java type that defines the service API. The type could be an interface, an abstract class, or even a regular Java class. Most of the time, the service type will be an interface. Having an interface is ideal because that way, you can have multiple implementation types for it.

The service type is the means through which both the providers and consumers talk to each other. This begs the question of which module the service type should be in? Since it is shared by multiple modules, and we don't want the providers and consumers to be tightly coupled, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required