简体   繁体   English

@JsonView如何使用@RequestBody

[英]@JsonView how to use with @RequestBody

I want to add JsonView functionality to control input of my application. 我想添加JsonView功能来控制我的应用程序的输入。 And I find that I can use this annotation with RequestBody in Spring 4.1.0.RELEASE but get error this annotation not allowed here 我发现我可以在Spring 4.1.0.RELEASE中使用RequestBody的这个注释但是这里得到错误这个注释不允许

 public ResponseEntity<User> update(@RequestHeader(value="Access-key") String accessKey,
                                         @RequestHeader(value="Secret-key") String secretKey,
                                         @JsonView(View.Summary.class) @RequestBody User user) throws Exception{

@JsonView annotation is supported on method parameters since version 2.5 of Jackson. 自Jackson版本2.5以来,方法参数支持@JsonView注释。 You must therefore upgrade your Jackson dependency for it to work. 因此,您必须升级您的Jackson依赖项才能使其正常工作。

Source: Github 资料来源: Github

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM