1. Parameters for handling the URI portion of the request: @PathVariable.
2. Handle the parameters of the request header section: @RequestHeader, @CookieValue
@RequestHeader annotations, you can bind the value of the header portion of a request to a method parameter.
@CookieValue can bind the value of the cookie in the request header to the parameters of the method.
[Email protected] annotations are used to receive the parameters in the address, and the format of the parameter is http://*****?uid=111111&uname= Zhang San.
[Email protected] annotations are used to receive parameters from the body of the request, @RequestBody can put multiple parameters into an entity class or map.
5. Parameter Validation @valid, @Validated
@Valid is used when using hibernate validation
@Validated is used only with the spring Validator check mechanism, @Validated is a single package of @valid and is used by the spring-provided checksum mechanism. @Valid does not provide grouping functionality
@Validated annotations can use a model to receive the parameters in the Address bar, and the format of the parameter is http://*****?uid=111111&uname= Zhang San.
To sort a group @GroupSequence annotations
Attention:
The A.bindingresult object must be next to the @Valid or @validated, otherwise it cannot receive the error message.
B. Multiple validation result objects are added when working with multiple model objects on a single functional method
Usage scenarios such as:
Spring MVC + @Valid/@Validated + @RequestBody receive JSON to verify JavaBean data validity
Get input parameter annotations using the Spring controller