Module org.elasticsearch.server
Package org.elasticsearch.injection
package org.elasticsearch.injection
Our dependency injection technologies: our bespoke injector, plus our legacy vendored version of Google Guice.
Usage
The new injector isInjector
.
You create an instance using Injector.create()
,
call various methods like Injector.addClass(java.lang.Class<?>)
to configure it,
then call Injector.inject(java.util.Collection<? extends java.lang.Class<?>>)
to cause the constructors to be called.
Operation
Injection proceeds in three phases:-
Configuration: the
Injector
captures the user's intent in the form ofInjectionSpec
objects, one for each class. -
Planning: the
Planner
analyzes theInjectionSpec
objects, validates them, and generates a plan in the form of a list ofInjectionStep
objects. -
Execution: the
PlanInterpreter
runs the steps in the plan, in sequence, to actually instantiate the objects and pass them to each others' constructors.
Google Guice
The older injector, based on Google Guice, is in theguice
package.
The new injector is unrelated to Guice, and is intended to replace Guice eventually.-
Classes