I know about @Valid
annotation to instruct spring to validate for example a Controller argument according to JSR-303 in such this example:
@GetMappi
unfortunately there is no "legal" way to do it.
Furthermore @Valid
is not enough. You need also a BindingResult
method parameter to be able to check the validation result: bindingResult.hasErrors()
If you don't want to use BindingResult
, you could write your own Validator and throw an Exception in case of invalid input.