Dependency Injection Container
The Container class provides a way to manage dependencies and their lifecycles. It supports various binding types, contextual bindings, and middleware.
contextualBindings: Map<Bindable, ContextualBinding[]>
middlewares: Middleware[]
resolvingStack: Bindable[]
applyMiddleware(factory: () => any): any
Bind a type to a factory function.
build(binding: Binding,context?: Bindable,): any
createChild(): IContainer
Create a child container.
createInstance<T>(Target: Bindable & WithParamTypes): T
Create an instance of a class with dependencies.
createScope(): IContainer
Create a new scope.
dispose(): void
Dispose of the container and its bindings.
getAlias(abstract: Bindable): Bindable
instance(abstract: Bindable,instance: any,): this
Bind an instance.
lazyBind<T>(token: any,factory: () => T,): void
Lazy bind a type to a factory function.
resolve<T = any>(abstract: Bindable,context?: Bindable,): T
Resolve a type.
resolveAsync<T = any>(abstract: Bindable,context?: Bindable,): Promise<T>
Resolve a type asynchronously.
resolveWithContext(abstract: Bindable,context: Bindable,): any
use(middleware: Middleware): void
Use a middleware function.
when(concrete: Bindable): IContextualBindingBuilder
Create a contextual binding.