You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In exploring a possible fix for this Spring Boot issue I've hit a problem when MethodValidationPostProcessor is configured with a CustomValidatorBean that's @Lazy. This small sample reproduces the problem with Spring Framework 4.3.8.RELEASE and Hibernate Validator 5.3:
Exception in thread "main" java.lang.AbstractMethodError: org.springframework.validation.beanvalidation.CustomValidatorBean.forExecutables()Ljavax/validation/executable/ExecutableValidator;
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy9.forExecutables(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:201)
at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
at com.example.LazyValidatorProblem$SampleService$$EnhancerBySpringCGLIB$$d8a8543a.doSomething(<generated>)
at com.example.LazyValidatorProblem.main(LazyValidatorProblem.java:58)
This happens because SpringValidatorAdapter does not implement the forExecutables method that was added to Validator in Bean Validation 1.1. The problem does not occur with Spring Framework 5.0 as a result of this commit.
Andy Wilkinson opened SPR-15629 and commented
In exploring a possible fix for this Spring Boot issue I've hit a problem when
MethodValidationPostProcessor
is configured with aCustomValidatorBean
that's@Lazy
. This small sample reproduces the problem with Spring Framework 4.3.8.RELEASE and Hibernate Validator 5.3:The failure that you should see is:
This happens because
SpringValidatorAdapter
does not implement theforExecutables
method that was added toValidator
in Bean Validation 1.1. The problem does not occur with Spring Framework 5.0 as a result of this commit.Affects: 4.3.8
Reference URL: spring-projects/spring-boot#9416
Issue Links:
@Lazy
validatorReferenced from: commits b7337b3, 8330134, 55b0fe1
The text was updated successfully, but these errors were encountered: