@Api annotation

@Apiis a commonly used annotation used to mark and describe RESTful API interfaces in Java code.

@ApiAnnotations are usually used together with other annotations (such as @RestController, @RequestMappingetc.) to provide metadata and documentation information for the API. It can be used at both class level and method level.

At the class level, @Apiannotations are used to describe information about the entire API controller class, including the name, description, author, etc. of the API.

At the method level, @Apiannotations are used to describe information about a single API interface, including the name, description, parameters, return values, etc. of the interface.

Here are @Apisome common properties of annotations:

  • value: Specify the name of the API.
  • tags: Specify the label of the API, used to classify the API.
  • description: Describe the functions and functions of the API.
  • produces: Specify the response content type of the API.
  • consumes: Specifies the request content type accepted by the API.
  • authorizations: Specify the security authentication requirements of the API.
  • hidden: Specify whether to hide the API.

Using @Apiannotations can provide a description of the documentation and metadata of the API interface, making it easier for developers and users to understand and use the interface. This information can be parsed and displayed by automatically generated API documentation tools (such as Swagger).

It should be noted that @Apiannotations themselves do not affect the actual functions and logic of the API, they just provide a way to mark and describe the API.

Guess you like

Origin blog.csdn.net/qq_44543774/article/details/133199181