Builds the graphs of objects that make up your application. The injector tracks the dependencies for each type and uses bindings to inject them. This is the core of Guice, although you rarely interact with it directly. This "behind-the-scenes" operation is what distinguishes dependency injection from its cousin, the service locator pattern.
Contains several default bindings:
- This {@link Injector} instance itself
- A {@code Provider} for each binding of type {@code T}
- The {@link java.util.logging.Logger} for the class being injected
- The {@link Stage} in which the Injector was created
Injectors are created using the facade class {@link Guice}.
An injector can also {@link #injectMembers(Object) inject the dependencies} ofalready-constructed instances. This can be used to interoperate with objects created by other frameworks or services.
Injectors can be {@link #createChildInjector(Iterable) hierarchical}. Child injectors inherit the configuration of their parent injectors, but the converse does not hold.
The injector's {@link #getBindings() internal bindings} are available for introspection. Thisenables tools and extensions to operate on an injector reflectively.
@author crazybob@google.com (Bob Lee)
@author jessewilson@google.com (Jesse Wilson)