How to map paramType to body in an swagger document using the parameters received by @ modelAttribute

1 the @ modelAttribute receive parameter is used in the

1 post request, and paramterType is query, in the swagger-ui document. I want to get

of type body.

2, code

@ ApiModel ("user description")
public class User {

@ApiModelProperty(value="",required=true)  
private String name;  
@ApiModelProperty(value="",required=true)  
private Integer age;  

public String getName() {  
    return name;  
}  

public void setName(String name) {  
    this.name = name;  
}  

public Integer getAge() {  
    return age;  
}  

public void setAge(Integer age) {  
    this.age = age;  
}  

@Override  
public String toString() {  
    return "User [name=" + name + ", age=" + age + "]";  
}  

}

@ ApiOperation (value = "GET BODY update data")

@RequestMapping(value = "model/{id}", method = RequestMethod.GET)  
public ResponseEntity<ModelMap> modelResource(@ApiParam(value="",required=true) @ModelAttribute User user,   
        @ApiParam(name = "id", value = "", required = true) @PathVariable String id){  
    System.out.println(user);  
    ModelMap modelMap = new ModelMap();  
    modelMap.put("status", HttpStatus.OK.value());  
    modelMap.put("timestamps",System.currentTimeMillis());  
    modelMap.put("msg", HttpStatus.OK.getReasonPhrase());  
    modelMap.put("user", user);  
    modelMap.put("apiversion", 2);  
    return ResponseEntity.status(HttpStatus.OK).body(modelMap);  
}  

effect
clipboard.png

clipboard.png

do not want to change the @ modelAttribute annotation, but get the parameter of type body

Mar.28,2021

@ ModelAttribute User user change to @ RequestBody User user

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31423-2bd61.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31423-2bd61.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?