public final class InternalInjectorCreatorextends Object
Builds a tree of injectors. This is a primary injector, plus child injectors needed for each
Binder.newPrivateBinder() private environment. The primary injector is not necessarily a
top-level injector.
Injector construction happens in two phases.
Static building. In this phase, we interpret commands, create bindings, and inspect
dependencies. During this phase, we hold a lock to ensure consistency with parent
injectors. No user code is executed in this phase.
Dynamic injection. In this phase, we call user code. We inject members that requested
injection. This may require user's objects be created and their providers be called. And we
create eager singletons. In this phase, user code may have started other threads. This
phase is not executed for injectors created using the tool stage
Returns the injector being constructed. This is not necessarily the root injector.
injectDynamically
privatevoidinjectDynamically()
Inject everything that can be injected. This method is intentionally not synchronized. If we
locked while injecting members (ie. running user code), things would deadlock should the user
code build a just-in-time binding from another thread.