From a3fd00eadbc59698a9c7870fb3539431d4579f00 Mon Sep 17 00:00:00 2001 From: Sebastien Deleuze Date: Tue, 30 Sep 2014 05:44:51 +0200 Subject: [PATCH] Improve @JsonView reference documentation Issue: SPR-12270 --- src/asciidoc/index.adoc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/asciidoc/index.adoc b/src/asciidoc/index.adoc index 28aa5f653d..b026f4e63c 100644 --- a/src/asciidoc/index.adoc +++ b/src/asciidoc/index.adoc @@ -31640,7 +31640,8 @@ HTTP response body. In order to provide such capability, Spring MVC has built-in rendering with http://wiki.fasterxml.com/JacksonJsonViews[Jackson's Serialization Views]. To use it with an `@ResponseBody` controller method or controller methods that return -`ResponseEntity`, simply add the `@JsonView` annotation: +`ResponseEntity`, simply add the `@JsonView` annotation with a class argument specifying +the view class or interface to be used: [source,java,indent=0] [subs="verbatim,quotes"] @@ -31683,6 +31684,14 @@ To use it with an `@ResponseBody` controller method or controller methods that r } ---- +[NOTE] +==== +Note that despite `@JsonView` allowing for more than one class to +be specified, the use on a controller method is only supported with +exactly one class argument. Consider the use of a composite interface +if you need to enable multiple views. +==== + For controllers relying on view resolution, simply add the serialization view class to the model: