We know that in the daily development process, whether traditional ssm project, or spring boot project from the front end of the parameters passed to it, I need to process parameters, here are a few notes on the request parameters in spring boot project, several major: @ Param, @ PathVariable, @ RequestParam, @ requestBody, there is a comment made on the date of processing @Jsonformat
@Param
The notes said that when there are multiple parameters we pass the time, if not this parameter to add notes, then the sql statement xml file mybatis of the parameters will have to be written arg0, arg1, arg2 ... etc., or param1, param2, param3 ... and so on, added this comment, specify the name in the annotation parameters, then the sql statement xml file can be specified with a name
below to see how to use specific
@PathVariable
This represents the annotation request url placeholder parameter passed in the front end, for example, {id} corresponding processor parameter binding
we url passed in front end
rear end of the process parameters
@RequestBody
This annotation indicates json data received from the front end of transfer, the data in json requesting entity, since it is then the requesting entity, at the front end transmission mode can not get a way, it is necessary with the post, and RequestParam simultaneously requestBody use, but RequestBody parameters can only be used once, and RequestParam can be used in different parameters
@RequestParam
The annotation data indicative of the distal end is passed before the key / value pairs, a plurality of parameters RequestParam annotations
@JsonFormat
When we time the database is passed from the rear end to the front end of show, the distal end will resolve discrepancies date, no add, in this case we may correspond with the data entity class field in the database corresponding to above this annotation, and specify date format in the database can be consistent