Skip to content

Dependency Injection (API)

@Use

Inject Bean instance through @Use decorator function

typescript
export declare function Use(options?: IDecoratorUseOptions): PropertyDecorator;
export declare function Use<T extends keyof IBeanRecord>(beanFullName?: T): PropertyDecorator;
  • arguments
NameDescription
No parametersInject through Bean Class type
beanFullNameInject through Bean identifier
options: IDecoratorUseOptionsInjection parameters
  • options: IDecoratorUseOptions
typescript
export interface IDecoratorUseOptions {
  beanFullName?: keyof IBeanRecord;
  name?: string;
  injectionScope?: InjectionScope;
}
NameDescription
beanFullNameInject through Bean identifier
nameInject through registration name
injectionScopesys/app/ctx/new/host/skipSelf
  • Variable name: If no injection parameters are specified and the type of the bean class is not specified, then the variable name is used directly to find the existing bean instance in the bean container

@UseScope

Inject the module's Scope object through the @UseScope decorator function

@UseComposable

Inject the Vue Composables through the @UseComposable decorator function

Released under the MIT License.