I know about @Valid
annotation to instruct spring to validate for example a Controller argument according to JSR-303 in such this example:
@GetMappi
It should be possible to do this however like Markus in the similar question I'm not sure I agree its solving an actual problem.
Without getting too far into the weeds, Spring performs validation as part of model binding within ModelAttributeMethodProcessor's validateIfApplicable method. Per the javadoc
Validate the model attribute if applicable. The default implementation checks for @javax.validation.Valid, Spring's Validated, and custom annotations whose name starts with "Valid".
To override this functionality you need to create a custom ModelAttributeMethodProcessor / ServletModelAttributeMethodProcessor. You then would need to register it as an argument resolver
public class ApplicationConfiguration extends WebMvcConfigurerAdapter {
@Override
public void addArgumentResolvers(final List argumentResolvers) {
// add your custom model attribute processor here
}
}