@Api: Used on the requested class , Represents a description of the class tags=" Explain the role of this class , Can be in UI Comments seen on the interface "
value=" This parameter is meaningless , stay UI You can also see it on the interface , So there is no need to configure " @ApiOperation: Used in the requested method , Explain the purpose of the method , effect
value=" Explain the purpose of the method , effect " notes=" Method notes " @ApiImplicitParams: Used in the requested method , Represents a set of parameter descriptions
@ApiImplicitParam: Used in @ApiImplicitParams In the notes , Specify the various aspects of a request parameter name: Parameter name
value: Chinese character description of parameters , explain required: Whether the parameter must be passed paramType: Where are the parameters placed · header -->
Acquisition of request parameters :@RequestHeader · query --> Acquisition of request parameters :@RequestParam · path( be used for restful Interface )-->
Acquisition of request parameters :@PathVariable · body( Not commonly used ) · form( Not commonly used )
dataType: Parameter type , default String, Other values dataType="Integer" defaultValue: The default value of the parameter
@ApiResponses: Used in the requested method , Represents a set of responses @ApiResponse: Used in @ApiResponses in , It is generally used to express the response information of an error
code: number , for example 400 message: information , for example " The request parameters are not filled in properly " response: The class that throws the exception
@ApiModel: Used on response classes , Represents a message that returns response data ( This is usually used in post When it was created , use @RequestBody Such a scene ,
Request parameters cannot be used @ApiImplicitParam When the annotation is used to describe ) @ApiModelProperty: Used on attributes , Describes the properties of the response class
1,@Api: Used on the requested class , Explain the role of this class
@Api: Used on the requested class , Explain the role of this class tags=" Explain the role of this class " value=" This parameter is meaningless , So there is no need to configure "
2,@ApiOperation: Used in the requested method , Explain the role of the method
@ApiOperation:" Used in the requested method , Explain the role of the method " value=" Explain the role of the method " notes=" Method notes " Examples :
@ApiOperation(value=" User registration ",notes=" cell-phone number , All passwords are required , Fill in with age , But it has to be a number ")
3,@ApiImplicitParams: Used in the requested method , Contains a set of parameter descriptions
@ApiImplicitParams: Used in the requested method , Contains a set of parameter descriptions @ApiImplicitParam: Used in @ApiImplicitParams
In the notes , Specifies the configuration information for a request parameter name: Parameter name value: Chinese character description of parameters , explain required: Whether the parameter must be passed paramType: Where are the parameters placed
· header --> Acquisition of request parameters :@RequestHeader · query --> Acquisition of request parameters :@RequestParam ·
path( be used for restful Interface )--> Acquisition of request parameters :@PathVariable · body( Not commonly used ) · form( Not commonly used )
dataType: Parameter type , default String, Other values dataType="Integer" defaultValue: Example of default values for parameters
@ApiImplicitParams({
@ApiImplicitParam(name="mobile",value=" cell-phone number ",required=true,paramType="form"),
@ApiImplicitParam(name="password",value=" password ",required=true,paramType="form"),
@ApiImplicitParam(name="age",value=" Age ",required=true,paramType="form",dataType="Integer")
})

4,@ApiResponses: The method used for the request , Represents a set of responses
@ApiResponses: The method used for the request , Represents a set of responses @ApiResponse: Used in @ApiResponses in , It is generally used to express the response information of an error
code: number , for example 400 message: information , for example " The request parameters are not filled in properly " response: Example of a class that throws an exception @ApiOperation(value =
"select1 request ",notes = " Multiple parameters , Multiple query parameter types ") @ApiResponses({
@ApiResponse(code=400,message=" The request parameters are not filled in properly "),
@ApiResponse(code=404,message=" The request path is not available or the page Jump path is not correct ") })
5,@ApiModel: Used on response classes , Represents a message that returns response data
@ApiModel: Used on response classes , Represents a message that returns response data ( This is usually used in post When it was created , use @RequestBody Such a scene ,
Request parameters cannot be used @ApiImplicitParam When the annotation is used to describe ) @ApiModelProperty: Used on attributes , Describes the properties of the response class
Examples import io.swagger.annotations.ApiModel; import
io.swagger.annotations.ApiModelProperty; import java.io.Serializable;
@ApiModel(description= " Return response data ") public class RestMessage implements
Serializable{ @ApiModelProperty(value = " Is it successful ") private boolean success=true;
@ApiModelProperty(value = " Return object ") private Object data; @ApiModelProperty(value
= " error number ") private Integer errCode; @ApiModelProperty(value = " error message ") private
String message; /* getter/setter */ }

Technology
©2019-2020 Toolsou All rights reserved,
( Super detail )Eclipse Using tutorials —— use Eclipse Create first HelloWorld! Database operation 5 code implementation mysql Addition, deletion, modification and query of database What can MCU do , Do you have any interesting works made by MCU or open source hardware Go to the interview after reading this , Steady over ~~ Single linked list of primary data structure (C Language implementation )SQL Comprehensive questions Employee unit comprehensive questions Python Implementation of Hanoi Tower code VHDL——JK trigger It's over , Starting salary 30k