Hibernate验证程序和Spring版本的兼容性

问题描述

我们使用的是休眠验证器版本5.2.5。最终版本是弹簧版本5.0.15RELEASE,用于验证输入数据以及bean-io框架。

现在,我们计划将休眠验证器升级到最新版本6.1.5,以提高工作流程的性能

请提供与最新休眠验证器兼容的spring框架版本。

解决方法

documentation的以下部分将为您提供提示。

从Spring 5.0开始,此类需要Bean Validation 1.1+,并特别支持Hibernate Validator 5.x (请参见setValidationMessageSource(org.springframework.context.MessageSource))。此类也与Bean Validation 2.0和Hibernate Validator 6.0在运行时兼容,并且特别注意:如果要调用BV 2.0的getClockProvider()方法,请获取本机{ {1}}到ValidatorFactory,然后在返回的本机引用上调用#unwrap(ValidatorFactory.class)方法。