Sanjaya Kumar Patel opened SPR-16234 and commented

Traditionally (non-reactive), we had been doing method parameter validation as below:

@Validated
@Service
public class FooService

@Validated(SignUpValidation.class)
public void signup(@Valid UserCommand userCommand) {

    ...
}

In a reactive world, this might look like:

@Validated
@Service
public class FooService

@Validated(SignUpValidation.class)
public Mono<Void> signup(@Valid Mono<UserCommand> userCommand) {

    ...
}

But this is not working. So, in summary:

  1. Support for Mono and Flux is missing when using MethodValidationPostProcessor
  2. Also need support for validation groups (See @Validated(SignUpValidation.class) above)

Affects: 5.0.1

Reference URL: https://stackoverflow.com/questions/47244769/how-to-validate-mono-when-using-spring-reactive

Comment From: rstoyanchev

Note that @Valid is supported in WebFlux in combination with reactive types. This ticket I believe is mainly for MethodValidationPostProcessor and use of method-level Validated.

Comment From: fgolygo

Any update on that?

Comment From: rstoyanchev

This is now supported by using doOnNext on the respective Mono and Flux in order to validate the actual values when they do materialize.