Aller au contenu principal
Version: 3.0.0

Existing decorator index

Midway provides a lot of decorator capabilities. These decorators are distributed in different packages and also provide different functions. This chapter provides a quick check list.


DecoratorModification positionDescription
@ProvideClassExpose a class to enable IoC containers to obtain metadata
@InjectPropertyInject objects into an IoC container
@ScopeClassSpecify scope
@InitMethodThe method that is automatically executed when the annotation object is initialized.
@DestroyMethodThe method performed when the annotation object is destroyed.
@AsyncClass[Deprecated] Indicates that it is an asynchronous function
@AutowireClass[Deprecated] The identification class is an automatic injection attribute
@AutoloadClassAllows classes to self-load execution
@ConfigurationClassIdentifies a container entry configuration class
@AspectClassIdentification interceptor
@ValidateMethodIdentification method, need to be verified
@RulePropertyCheck rules that identify DTO
@AppPropertyInject the current application instance
nullPropertyGet configuration
@LoggerPropertyGet a log instance
@ControllerClassIdentified as a Web controller
@GetMethodRegister as a route of GET type
@PostMethodRegister as a POST type route
@DelMethodRegister as a route of type DELETE
@PutMethodRegistered as a PUT type route
@PatchMethodRegister as a PATCH type route
@OptionsMethodRegister as a route of OPTIONS type
@HeadMethodRegister as a route of type HEAD
@AllMethodRegister as a full-type route
@SessionParameterGet ctx.session from parameter
@BodyParameterGet ctx.request.body from parameters
@QueryParameterGet ctx.query from parameter
@ParamParameterGet ctx.param from parameter
@HeadersParameterGet ctx.headers from parameter
@FileParameterGet the first upload file from the parameter
@FilesParameterGet all uploaded files from parameters
@FieldsParameterGet Form Field from Parameters (when uploading)
@RedirectMethodModify response jump
@HttpCodeMethodModify the response status code
@SetHeaderMethodModify response header
@ContentTypeMethodModify the Content-Type field in the response header
@ScheduleClassIdentified as an egg timed task
@PluginPropertyGet egg plug-in
@ProviderClassExposed microservice providers (producers)
@ConsumerClassExposed microservice caller (consumer)
@GrpcMethodMethodIdentify exposed gRPC methods
@FuncClass/Method[Deprecated] is identified as a function entry
@HandlerMethod[Deprecated] Cooperate with Marking Function
nullMethodIdentifies a function trigger
@TaskMethodDefine a distributed task
@TaskLocalMethodDefine a local task
nullClassDefine a self-triggered task


DecoratorModification positionRole
@EntityModelClassDefine an entity object
@InjectEntityModelPropertyInject an entity object
@EventSubscriberModelClassDefine event subscriptions


DecoratorModification positionDescription
@RulePropertyDefine a rule
@ValidateMethodIdentify a method that requires verification


DecoratorModification positionDescription