Update section on type conversion for web method arguments
Closes gh-26088
This commit is contained in:
parent
238354a081
commit
c22a483c3d
|
@ -2009,6 +2009,12 @@ By default, simple types (such as `int`, `long`, `Date`, and others) are support
|
||||||
can be customized through a `WebDataBinder` (see <<webflux-ann-initbinder>>) or by registering
|
can be customized through a `WebDataBinder` (see <<webflux-ann-initbinder>>) or by registering
|
||||||
`Formatters` with the `FormattingConversionService` (see <<core.adoc#format, Spring Field Formatting>>).
|
`Formatters` with the `FormattingConversionService` (see <<core.adoc#format, Spring Field Formatting>>).
|
||||||
|
|
||||||
|
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]]
|
[[webflux-ann-matrix-variables]]
|
||||||
==== Matrix Variables
|
==== Matrix Variables
|
||||||
|
|
|
@ -2216,6 +2216,13 @@ type conversion through a `WebDataBinder` (see <<mvc-ann-initbinder>>) or by reg
|
||||||
`Formatters` with the `FormattingConversionService`.
|
`Formatters` with the `FormattingConversionService`.
|
||||||
See <<core.adoc#format, Spring Field Formatting>>.
|
See <<core.adoc#format, Spring Field Formatting>>.
|
||||||
|
|
||||||
|
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]]
|
[[mvc-ann-matrix-variables]]
|
||||||
==== Matrix Variables
|
==== Matrix Variables
|
||||||
|
|
Loading…
Reference in New Issue