From c22a483c3d93d55df36a9c00f177faa86dcef431 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 16 Nov 2020 17:01:35 +0000 Subject: [PATCH] Update section on type conversion for web method arguments Closes gh-26088 --- src/docs/asciidoc/web/webflux.adoc | 6 ++++++ src/docs/asciidoc/web/webmvc.adoc | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/docs/asciidoc/web/webflux.adoc b/src/docs/asciidoc/web/webflux.adoc index c3e0d2cf34..7e1e52d3c4 100644 --- a/src/docs/asciidoc/web/webflux.adoc +++ b/src/docs/asciidoc/web/webflux.adoc @@ -2009,6 +2009,12 @@ By default, simple types (such as `int`, `long`, `Date`, and others) are support can be customized through a `WebDataBinder` (see <>) or by registering `Formatters` with the `FormattingConversionService` (see <>). +A practical issue in type conversion is the treatment of an empty String source value. +Such a value is treated as missing if it becomes `null` as a result of type conversion. +This can be the case for `Long`, `UUID`, and other target types. If you want to allow `null` +to be injected, either use the `required` flag on the argument annotation, or declare the +argument as `@Nullable`. + [[webflux-ann-matrix-variables]] ==== Matrix Variables diff --git a/src/docs/asciidoc/web/webmvc.adoc b/src/docs/asciidoc/web/webmvc.adoc index 16143be591..180de3e7f9 100644 --- a/src/docs/asciidoc/web/webmvc.adoc +++ b/src/docs/asciidoc/web/webmvc.adoc @@ -2216,6 +2216,13 @@ type conversion through a `WebDataBinder` (see <>) or by reg `Formatters` with the `FormattingConversionService`. See <>. +A practical issue in type conversion is the treatment of an empty String source value. +Such a value is treated as missing if it becomes `null` as a result of type conversion. +This can be the case for `Long`, `UUID`, and other target types. If you want to allow `null` +to be injected, either use the `required` flag on the argument annotation, or declare the +argument as `@Nullable`. + + [[mvc-ann-matrix-variables]] ==== Matrix Variables