Annotation Interface RequestJsonParam


@Target({PARAMETER,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface RequestJsonParam
An ext Annotation which can resolve json param from request parameters for HandlerMethodArgumentResolver like RequestParam and RequestBody.

Define an api with RequestJsonParam like this:

 @RestController
 public class JsonParamController{

      @GetMapping("/json")
      public Object json(@RequestJsonParam Object json){
          return json;
      }
 }
 

Then request this api with curl like this:

 curl http://localhost:8080/json?json={"name":haha}
 
从以下版本开始:
1.0.0
版本:
1.0.0
作者:
ilikly
另请参阅:
  • RequestParam
  • RequestBody
  • HandlerMethodArgumentResolver
  • 元素详细资料

    • value

      @AliasFor("name") String value
      默认值:
      ""
    • name

      @AliasFor("value") String name
      默认值:
      ""
    • required

      boolean required
      默认值:
      true
    • defaultValue

      String defaultValue
      默认值:
      "\n\t\t\n\t\t\n\ue000\ue001\ue002\n\t\t\t\t\n"