-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Thibault Kruse opened SPR-12863 and commented
Using JSR303 annotations and bean validation works gret for validating, but sadly the ConstraintViolationException class thrown by MethodValidationInterceptor does not provide any useful output as to the context of validation. So the log file does not help telling what went wrong.
See https://hibernate.atlassian.net/browse/BVAL-264
In order to work around this, it would be nice to wrap/extend Spring to prove an Exception with a better Error message.
Ideally I would want to override a method that creates the interceptor, such as:
@Bean
public MethodValidationPostProcessor methodValidator() {
@Override
return new MethodValidationPostProcessor() {
protected Advisor createAdvisor() {
Pointcut pointcut = new AnnotationMatchingPointcut(this.getValidatedAnnotationType(), true);
Advice advice = (this.getValidator() != null ? new CustomMethodValidationInterceptor(this.getValidator() :
new CustomMethodValidationInterceptor());
this.advisor = new DefaultPointcutAdvisor(pointcut, advice);
}
};
}
or something similar like
protected MethodValidationInterceptor createMethodValidationInterceptor() {...}
so that I can provide an interceptor that throws an Exception with a more useful message.
Affects: 4.1.6
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement