From d5eb6694163dbe3202114a0a86f63435ccedf176 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Thu, 23 Oct 2014 16:53:00 -0400 Subject: [PATCH] Add mention of java.util.Optional in @MVC Issue: SPR-12370 --- .../web/bind/annotation/RequestMapping.java | 6 ++++++ src/asciidoc/index.adoc | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java index 929c1b3de4..c12c79d72a 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java @@ -160,6 +160,12 @@ import java.util.concurrent.Callable; * context path, and the literal part of the servlet mapping. * * + *

Note: 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}. + * *

The following return types are supported for handler methods: *