Build document content using Swagger2
Import io.swagger.annotations.*; Import Lombok.
Allargsconstructor; Import Lombok.
Data; Import Lombok.
Noargsconstructor;
Import lombok.experimental.Accessors;
Import org.springframework.web.bind.annotation.GetMapping;
Import org.springframework.web.bind.annotation.PostMapping;
Import org.springframework.web.bind.annotation.RequestMapping;
Import Org.springframework.web.bind.annotation.RestController; /** * @author Created by Tan Jian on 2018/4/13 0013. Friday.
9:30. *©all Rights Reserved. * */** * used in class, description of the use of class/@Api (tags = {"Swagger2 Controller"}) @RequestMapping ("/swagger2") @RestController public class swagger 2Controller {/** * used in methods to illustrate the purpose of the method/@ApiOperation (value = "Get Method", notes = "get")/** * used in method, the use of the parameter/@ApiImplicitParams ({@ApiImplicitParam (name = "S", value = "Join", required = True, DEFA Ultvalue = "OK"})/** * used in the method, the way to describe the response * * * @ApiResponses ({@ApiResponse (code =, mess Age = "Request succeeded", response = Exception.class), @ApiResponse (code = 404, message = "Request Path Error", response = Exception.class)}) @GetM
Apping ("/get") Public String get (string s) {return s; @PostMapping ("/post") public Swaggerclass post () {return new Swaggerclass (). SetName ("document"). SetSize (5000
). Setdescribe ("Automatically generated documents"); /** * is used on the response class, stating that the response class */@ApiModel (description = "Returned response class") @Data @NoArgsConstructor @AllArg
Sconstructor @Accessors (chain = true) public class swaggerclass{@ApiModelProperty (value = "Name")
private String name;
@ApiModelProperty (value = "size") private int size;
@ApiModelProperty (value = "description") private String describe;
}
}