Bean Validation 2.0 CR 2 已发布,Bean Validation (JSR 303) 是一个数据验证的规范,为 JavaBean 验证定义了相应的元数据模型和 API 。 CR 2 是 CR 1 的更新版本,包含从审查开始的所有变更意见和评论。更新的规格文件可以在这里找到。 What’s new since CR 1? 鉴于还处于 CR 阶段,此版本的大部分更改属于 bug 修正、措辞澄清、格式化和其他相关改进。包含对 API 的两项改进: ConstraintDescriptor#validateUnwrappedValue() got renamed into getValueUnwrapping() (BVAL-674). The original method name sounded like a "command", whereas the new name makes clear it’s a "query" kind of method; also the members of the returned enum have been adapted to be in sync with the corresponding Unwrapping payload type names. We’ve also added a method ConstraintDescriptor#unwrap(Class), which will let providers expose additional functionality via extension interfaces, e.g. to explore new features which then can be standardized in a future spec revision. @ConvertGroup#from() has a default value of Default.class now (BVAL-689). This simplifies group conversions in the common case where the default group is converted into another group. 了解更多内容可查阅发行说明 Bean Validation 2.0 CR 2 发布,数据验证规范下载地址