Book Image

Learning Google Guice

By : Hussain Pithawala
Book Image

Learning Google Guice

By: Hussain Pithawala

Overview of this book

<p>Google Guice is an open source software framework for the Java platform released by Google under the Apache License. It provides support for dependency injection using annotations to configure Java objects.</p> <p>Learning Google Guice is a concise, hands-on book that covers the various areas of dependency injection using the features provided by the latest version of Google Guice. It focuses on core functionalities as well as the various extensions surrounding Guice that make it useful in other areas like web development, integration with frameworks for web development, and persistence.</p> <p>Learning Google Guice covers Guice extensions which avoid complex API usage. You will start by developing a trivial application and managing dependencies using Guice. As the book gradually progresses, you will continue adding complexity to the application while simultaneously learning how to use Guice features such as the Injector, Provider, Bindings, Scopes, and so on. Finally, you will retrofit the application for the Web, using Guice not only to manage dependencies, but also to solve configuration related problems.</p>
Table of Contents (17 chapters)
Learning Google Guice
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring a custom extension, guice-multibinder


Exploring a custom extension involves understanding how the custom extension works and what purpose it serves. In this topic, we will analyze guice-multibinder. During this, we will first inspect the important classes and interfaces in it, and later, how it provides an implementation of the extensions SPI. We will also explore the binding collection case in FlightEngineModule, where we prepare a collection of bindings using guice-multibinder.

Note

We discussed guice-multibinder extension in Chapter 3, Diving Deeper in Guice to illustrate binding collections. We pick it up again to explore the extensions SPI, because it gives us a good ground to analyze Injector bindings and a custom extensions case.

Let's look at the following class diagram for a few of the classes and interfaces in guice-multibinder extension. This is not a complete diagram, and discusses only relevant pieces, which come into action while we are discussing its internal working...