Commonly used annotations and where they are used are as follows:
@Api: Used on the requested class, indicating the common parameters for describing the class
Code example:
@Api(tags="登录")
@Controller
@RequestMapping(value="/sign")
public class LoginController {}
@ApiOperation: Used in the requested method, explaining the purpose and function of the method
Code example:
@ResponseBody
@PostMapping(value="/login")
@ApiOperation(value = "登录检测", notes="根据用户名判断用户是否存在")
public UserModel login(@RequestParam(value = "name", required = false) String account,
@RequestParam(value = "pass", required = false) String password){}
@ApiModel: Used on the response class to represent information that returns response data
@ApiModelProperty: Used on attributes to describe the attributes of the response class
Sample code:
@ApiModel(value="用户登录信息", description="判断用户是否存在")
public class UserModel implements Serializable{
private static final long serialVersionUID = 30;
@ApiModelProperty(value="用户名")
private String account;
@ApiModelProperty(value="密码")
private String password;
}