Spring webflux bean validation not working

后端 未结 3 1589
南笙
南笙 2021-02-15 17:56

I am trying to use bean validation in Webflux. This is what I have so far:

@PostMapping(\"contact\")
fun create(@RequestBody @Valid contact: Mono)         


        
3条回答
  •  日久生厌
    2021-02-15 18:26

    You need to also add bindingResult: BindingResult to as an extra parameter. When the method begins you can do something like bindingResult.isValid(). We use an aspect over all controller methods to return an error message with the validation errors to the user.

提交回复
热议问题