@@ -1661,9 +1661,8 @@ and others) and is equivalent to `required=false`.
1661
1661
See "`Any other argument`" later in this table.
1662
1662
1663
1663
| `Errors`, `BindingResult`
1664
- | For access to errors from validation and data binding for a command object
1665
- (that is, a `@ModelAttribute` argument) or errors from the validation of a `@RequestBody` or
1666
- `@RequestPart` argument. An `Errors`, or `BindingResult` argument must be declared
1664
+ | For access to errors from validation and data binding for a command object, i.e. a
1665
+ `@ModelAttribute` argument. An `Errors`, or `BindingResult` argument must be declared
1667
1666
immediately after the validated method argument.
1668
1667
1669
1668
| `SessionStatus` + class-level `@SessionAttributes`
@@ -2318,24 +2317,19 @@ you can declare a concrete target `Object`, instead of `Part`, as the following
2318
2317
<1> Using `@RequestPart` to get the metadata.
2319
2318
====
2320
2319
2321
- You can use `@RequestPart` combination with `javax.validation.Valid` or Spring's
2322
- `@Validated` annotation, which causes Standard Bean Validation to be applied.
2323
- By default, validation errors cause a `WebExchangeBindException`, which is turned
2324
- into a 400 (`BAD_REQUEST`) response. Alternatively, you can handle validation errors locally
2325
- within the controller through an `Errors` or `BindingResult` argument, as the following example shows:
2320
+ You can use `@RequestPart` in combination with `javax.validation.Valid` or Spring's
2321
+ `@Validated` annotation, which causes Standard Bean Validation to be applied. Validation
2322
+ errors lead to a `WebExchangeBindException` that results in a 400 (BAD_REQUEST) response.
2323
+ The exception contains a `BindingResult` with the error details and can also be handled
2324
+ in the controller method by declaring the argument with an async wrapper and then using
2325
+ error related operators:
2326
2326
2327
2327
====
2328
2328
[source,java,indent=0]
2329
2329
[subs="verbatim,quotes"]
2330
2330
----
2331
- @PostMapping("/")
2332
- public String handle(@Valid @RequestPart("meta-data") MetaData metadata, <1>
2333
- BindingResult result) { <2>
2334
- // ...
2335
- }
2336
- ----
2337
- <1> Using a `@Valid` annotation.
2338
- <2> Using a `BindingResult` argument.
2331
+ public String handle(@Valid @RequestPart("meta-data") Mono<MetaData> metadata) {
2332
+ // use one of the onError* operators...
2339
2333
====
2340
2334
2341
2335
To access all multipart data as a `MultiValueMap`, you can use `@RequestBody`,
@@ -2407,20 +2401,18 @@ You can use the <<webflux-config-message-codecs>> option of the <<webflux-config
2407
2401
configure or customize message readers.
2408
2402
2409
2403
You can use `@RequestBody` in combination with `javax.validation.Valid` or Spring's
2410
- `@Validated` annotation, which causes Standard Bean Validation to be applied.
2411
- By default, validation errors cause a `WebExchangeBindException`, which is turned
2412
- into a 400 (`BAD_REQUEST`) response. Alternatively, you can handle validation errors locally
2413
- within the controller through an `Errors` or a `BindingResult` argument. The following
2414
- example uses a `BindingResult` argument` :
2404
+ `@Validated` annotation, which causes Standard Bean Validation to be applied. Validation
2405
+ errors cause a `WebExchangeBindException`, which results in a 400 (BAD_REQUEST) response.
2406
+ The exception contains a `BindingResult` with error details and can be handled in the
2407
+ controller method by declaring the argument with an async wrapper and then using error
2408
+ related operators :
2415
2409
2416
2410
====
2417
2411
[source,java,indent=0]
2418
2412
[subs="verbatim,quotes"]
2419
2413
----
2420
- @PostMapping("/accounts")
2421
- public void handle(@Valid @RequestBody Account account, BindingResult result) {
2422
- // ...
2423
- }
2414
+ public void handle(@Valid @RequestBody Mono<Account> account) {
2415
+ // use one of the onError* operators...
2424
2416
----
2425
2417
====
2426
2418
0 commit comments