@Param @PathVariable @RequestParam @ResponseBody @RequestBody explanatory notes

@Param mainly used in the annotation process parameters dao class, when not in use @Param annotation, only a parameter of the function, and can only be used when the query value # {}, and which belongs to the class must Javabean, @Param annotations can use a number of parameters may be used when using # {} in the query or $ {}

 

@PathVariable for the URL request template variable parameter is mapped to a processing method, HTTP: //127.0.0.1: 8040 / the findById / 1-- >> @GetMapping ( "/ the findById / {ID}")      parameters Can not be empty

 

@RequestParam comment What are the main parameters:

value: Parameter name, i.e. the name reference request parameters, such as the username parameter value of the parameter in the region name for the request of the incoming username;

 

required: if necessary, the default is true, meaning the request must have the appropriate parameters, otherwise it will report a 404 error code;

 

defaultValue: Default, indicates the default value when the same name if the request has no parameters, for example:

 

public List<EasyUITreeNode> getItemTreeNode(@RequestParam(value="id",defaultValue="0")long parentId)

 

@ResponseBody result of the response into json format

 

@RequestBody request parameters into json format

 

Guess you like

Origin www.cnblogs.com/wenbiquan/p/11391054.html