It is currently impossible to use @Validfor individuals @RequestParam, @PathVariableetc. to run the check. This is the corresponding function request in Spring Issue Tracker. Let our fingers cross for Spring 4.1!
In your case, you need to either use @ModelAttributeor perform a custom check inside the controller (or perhaps a Spring interceptor if you want the same check to be applied to multiple endpoints)
source
share