An instance of "org.springframework.validation.beanvalidation.BeanValidationPostProcessor" with property "afterInitialization=true" fails to validate a bean instance for which a cglib proxy has been created around.
Example: If a bean class declares a javax.validation.NotNull constraint for a bean property, then the validation fails on the cglib proxy instance as Spring uses delegation for proxies and the bean property is null on the cglib proxy instance.
For LegacyDao Spring creates an AOP proxy around for PersistenceExceptionTranslator, because of the Repository annotation. If LegacyDao is validated by BeanValidationPostProcessor(afterInitialization=true), then the validation fails.
Validation performed by BeanValidationPostProcessor for a proxy instance should be done on the ultimate target object and not on intermediate proxy instances.
Since this changes the actual object to validate in such a scenario and introduces a dependency on org.springframework.aop (which is commonly present for spring-context but technically optional), I've only revised this for 5.1.