Skip to content

Commit c22a483

Browse files
committed
Update section on type conversion for web method arguments
Closes gh-26088
1 parent 238354a commit c22a483

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/docs/asciidoc/web/webflux.adoc

+6
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,12 @@ By default, simple types (such as `int`, `long`, `Date`, and others) are support
20092009
can be customized through a `WebDataBinder` (see <<webflux-ann-initbinder>>) or by registering
20102010
`Formatters` with the `FormattingConversionService` (see <<core.adoc#format, Spring Field Formatting>>).
20112011

2012+
A practical issue in type conversion is the treatment of an empty String source value.
2013+
Such a value is treated as missing if it becomes `null` as a result of type conversion.
2014+
This can be the case for `Long`, `UUID`, and other target types. If you want to allow `null`
2015+
to be injected, either use the `required` flag on the argument annotation, or declare the
2016+
argument as `@Nullable`.
2017+
20122018

20132019
[[webflux-ann-matrix-variables]]
20142020
==== Matrix Variables

src/docs/asciidoc/web/webmvc.adoc

+7
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,13 @@ type conversion through a `WebDataBinder` (see <<mvc-ann-initbinder>>) or by reg
22162216
`Formatters` with the `FormattingConversionService`.
22172217
See <<core.adoc#format, Spring Field Formatting>>.
22182218

2219+
A practical issue in type conversion is the treatment of an empty String source value.
2220+
Such a value is treated as missing if it becomes `null` as a result of type conversion.
2221+
This can be the case for `Long`, `UUID`, and other target types. If you want to allow `null`
2222+
to be injected, either use the `required` flag on the argument annotation, or declare the
2223+
argument as `@Nullable`.
2224+
2225+
22192226

22202227
[[mvc-ann-matrix-variables]]
22212228
==== Matrix Variables

0 commit comments

Comments
 (0)