Skip to Content
Java 9 Dependency Injection
book

Java 9 Dependency Injection

by Nilang Patel, Krunal Patel
April 2018
Intermediate to advanced content levelIntermediate to advanced
246 pages
6h 11m
English
Packt Publishing
Content preview from Java 9 Dependency Injection

Module interface

This is a special interface that you use to tell Guice which implementations go with which interfaces. Modules are objects that preserve a set of bindings. It is viable to have multiple modules in a piece of software. Injectors interact with modules to get the feasible bindings.

The module is represented by using an interface with a method referred to as Module.configure(), which ought to be overridden with the aid of the application to populate the bindings. If we rewrite our ApplicationModule by implementing the Module interface, then it would look like this:

import com.google.inject.Module;import com.packt.guice.di.impl.SMSService;import com.packt.guice.di.service.NotificationService;public class ApplicationModule implements ...
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.
Start your free trial

You might also like

Pro CDI 2 in Java EE 8: An In-Depth Guide to Context and Dependency Injection

Pro CDI 2 in Java EE 8: An In-Depth Guide to Context and Dependency Injection

Jan Beernink, Arjan Tijms
Dependency Injection

Dependency Injection

Dhananjay Prasanna

Publisher Resources

ISBN: 9781788296250Supplemental Content