Package com.linecorp.armeria.common
Interface DependencyInjector
- All Superinterfaces:
AutoCloseable
,SafeCloseable
- All Known Implementing Classes:
SpringDependencyInjector
Injects dependencies that are specified in
RequestConverter.value()
,
ResponseConverter.value()
, ExceptionHandler.value()
, Decorator.value()
and
DecoratorFactory.value()
.
If the dependencies are not injected by this DependencyInjector
, they are created via the default
constructor, which does not have a parameter, of the classes.-
Method Summary
Modifier and TypeMethodDescription<T> T
getInstance
(Class<T> type) Returns the instance of the specifiedClass
.static DependencyInjector
ofSingletons
(Iterable<Object> singletons) Returns aDependencyInjector
that injects dependencies using the specified singleton instances.static DependencyInjector
ofSingletons
(Object... singletons) Returns aDependencyInjector
that injects dependencies using the specified singleton instances.default DependencyInjector
orElse
(DependencyInjector dependencyInjector) Returns a newDependencyInjector
that triesgetInstance(Class)
of thisDependencyInjector
first and the specifiedDependencyInjector
.Methods inherited from interface com.linecorp.armeria.common.util.SafeCloseable
close
-
Method Details
-
ofSingletons
Returns aDependencyInjector
that injects dependencies using the specified singleton instances. The instances are closed if it implementsAutoCloseable
when theServer
stops. -
ofSingletons
Returns aDependencyInjector
that injects dependencies using the specified singleton instances. The instances are closed if it implementsAutoCloseable
when theServer
stops. -
getInstance
Returns the instance of the specifiedClass
. -
orElse
Returns a newDependencyInjector
that triesgetInstance(Class)
of thisDependencyInjector
first and the specifiedDependencyInjector
.
-