Skip to main content

Paul Sandoz: Modular services with OpenJDK Jigsaw and Guice

Paul Sandoz demonstrates Modular services with OpenJDK Jigsaw and Guice:

This blog entry describes an experiment exploring the connection between Java modules and services in OpenJDK Jigsaw and the dependency injection framework Guice.

Modular services in Jigsaw define a very simple way to bind a (service) interface to implementations (service provider classes) and, using java.util.ServiceLoader, a way to iterate through all (service) instances of implementations bound to an interface.

Guice supports a rich binding model and scoping model. Guice can support a JDK services style approach using multibindings where service instances are obtained by referencing an injection type Set<T> where T is the service interface...

Community: OpenJDK