Package com.linecorp.armeria.common
Interface DependencyInjector
- All Superinterfaces:
AutoCloseable,SafeCloseable
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> TgetInstance(Class<T> type) Returns the instance of the specifiedClass.static DependencyInjectorofSingletons(Iterable<Object> singletons) Returns aDependencyInjectorthat injects dependencies using the specified singleton instances.static DependencyInjectorofSingletons(Object... singletons) Returns aDependencyInjectorthat injects dependencies using the specified singleton instances.default DependencyInjectororElse(DependencyInjector dependencyInjector) Returns a newDependencyInjectorthat triesgetInstance(Class)of thisDependencyInjectorfirst and the specifiedDependencyInjector.Methods inherited from interface com.linecorp.armeria.common.util.SafeCloseable
close
-
Method Details
-
ofSingletons
Returns aDependencyInjectorthat injects dependencies using the specified singleton instances. The instances are closed if it implementsAutoCloseablewhen theServerstops. -
ofSingletons
Returns aDependencyInjectorthat injects dependencies using the specified singleton instances. The instances are closed if it implementsAutoCloseablewhen theServerstops. -
getInstance
Returns the instance of the specifiedClass. -
orElse
Returns a newDependencyInjectorthat triesgetInstance(Class)of thisDependencyInjectorfirst and the specifiedDependencyInjector.
-