added MethodValidationInterceptor/PostProcessor for Hibernate Validator 4.2 based method validation; renamed Spring's variant of @Valid to @Validated
This commit is contained in:
@@ -138,7 +138,7 @@ public class RequestPartMethodArgumentResolver extends AbstractMessageConverterM
|
||||
if (arg != null) {
|
||||
Annotation[] annotations = parameter.getParameterAnnotations();
|
||||
for (Annotation annot : annotations) {
|
||||
if ("Valid".equals(annot.annotationType().getSimpleName())) {
|
||||
if (annot.annotationType().getSimpleName().startsWith("Valid")) {
|
||||
WebDataBinder binder = binderFactory.createBinder(request, arg, partName);
|
||||
Object hints = AnnotationUtils.getValue(annot);
|
||||
binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
|
||||
|
||||
@@ -71,7 +71,7 @@ public class RequestResponseBodyMethodProcessor extends AbstractMessageConverter
|
||||
Object arg = readWithMessageConverters(webRequest, parameter, parameter.getParameterType());
|
||||
Annotation[] annotations = parameter.getParameterAnnotations();
|
||||
for (Annotation annot : annotations) {
|
||||
if ("Valid".equals(annot.annotationType().getSimpleName())) {
|
||||
if (annot.annotationType().getSimpleName().startsWith("Valid")) {
|
||||
String name = Conventions.getVariableNameForParameter(parameter);
|
||||
WebDataBinder binder = binderFactory.createBinder(webRequest, arg, name);
|
||||
Object hints = AnnotationUtils.getValue(annot);
|
||||
|
||||
Reference in New Issue
Block a user