Skip to content

Commit a3fd00e

Browse files
committed
Improve @JSONVIEW reference documentation
Issue: SPR-12270
1 parent 77abe07 commit a3fd00e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/asciidoc/index.adoc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31640,7 +31640,8 @@ HTTP response body. In order to provide such capability, Spring MVC has built-in
3164031640
rendering with http://wiki.fasterxml.com/JacksonJsonViews[Jackson's Serialization Views].
3164131641

3164231642
To use it with an `@ResponseBody` controller method or controller methods that return
31643-
`ResponseEntity`, simply add the `@JsonView` annotation:
31643+
`ResponseEntity`, simply add the `@JsonView` annotation with a class argument specifying
31644+
the view class or interface to be used:
3164431645

3164531646
[source,java,indent=0]
3164631647
[subs="verbatim,quotes"]
@@ -31683,6 +31684,14 @@ To use it with an `@ResponseBody` controller method or controller methods that r
3168331684
}
3168431685
----
3168531686

31687+
[NOTE]
31688+
====
31689+
Note that despite `@JsonView` allowing for more than one class to
31690+
be specified, the use on a controller method is only supported with
31691+
exactly one class argument. Consider the use of a composite interface
31692+
if you need to enable multiple views.
31693+
====
31694+
3168631695
For controllers relying on view resolution, simply add the serialization view class
3168731696
to the model:
3168831697

0 commit comments

Comments
 (0)