Add mention of java.util.Optional in @MVC
Issue: SPR-12370
This commit is contained in:
parent
687955a704
commit
d5eb669416
|
|
@ -160,6 +160,12 @@ import java.util.concurrent.Callable;
|
|||
* context path, and the literal part of the servlet mapping.
|
||||
* </ul>
|
||||
*
|
||||
* <p><strong>Note: </strong> JDK 1.8's {@code java.util.Optional} is supported
|
||||
* as a method parameter type with annotations that provide a {@code required}
|
||||
* attribute (e.g. {@code @RequestParam}, {@code @RequestHeader}, etc.) The use
|
||||
* of {@code java.util.Optional} in those cases is equivalent to having
|
||||
* {@code required=false}.
|
||||
*
|
||||
* <p>The following return types are supported for handler methods:
|
||||
* <ul>
|
||||
* <li>A {@code ModelAndView} object (Servlet MVC or Portlet MVC),
|
||||
|
|
|
|||
|
|
@ -30887,6 +30887,13 @@ this working you have to reorder the parameters as follows:
|
|||
public String processSubmit(**@ModelAttribute("pet") Pet pet**, **BindingResult result**, Model model) { ... }
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
JDK 1.8's `java.util.Optional` is supported as a method parameter type with annotations
|
||||
that have a `required` attribute (e.g. `@RequestParam`, `@RequestHeader`, etc. The use
|
||||
of `java.util.Optional` in those cases is equivalent to having `required=false`.
|
||||
====
|
||||
|
||||
|
||||
[[mvc-ann-return-types]]
|
||||
===== Supported method return types
|
||||
|
|
|
|||
Loading…
Reference in New Issue