在赶上上周发布的 Bean Valdiation 规范版本(1.1.0.Beta3)之后,我们很高兴提供以下版本

Bean Validation TCK 1.1.0.Beta3

  • 在 JBoss Maven 仓库下,GAV 为 org.hibernate.beanvalidation.tck:beanvalidation-tck-tests:1.1.0.Beta3 的 Maven 艺术品
  • SourceForge 上的 Zip 和 tar 打包文件

Hibernate Validator 5.0.0.Beta1

  • 在 JBoss Maven 仓库下,GAV 为 org.hibernate:hibernate-validator:5.0.0.Beta1 的 Maven 艺术品
  • SourceForge 上的 Zip 和 tar 打包文件

由于规范在其最新版本中解决了 38 个问题,我们无法完全同步 TCK 和 RI。仍有一些缺失的 TCK 测试,RI 也缺少一些功能。例如,方法验证的 XML 配置仍在进行中(见 HV-373)。

TCK 解决了 6 个问题,Hibernate Validator 解决了 36 个。如果您想知道,TCK 中的主要工作是添加对新 Bean Validation 1.1 特性的测试。这在 BVTCK-32 中得到解决,该问题单独有 12 个拉取请求。请随意审查这些测试,以验证我们是否走上了正确的道路 ;-)

最值得注意的是,我们在文档方面落后了。无论是TCK文档,还是Hibernate Validator文档,都可能需要一些关爱。你一直想贡献力量,但不知道如何入手?现在正是你的机会!通过电子邮件联系我们或使用问题跟踪器

最后但同样重要的是,这里有一些关于这次发布的新内容的预告。从HV-676开始,现在可以在约束消息描述符中使用统一表达式语言(UEL)。我们之前已经在这方面提供了一些功能,比如ValueFormatterMessageInterpolator(现在已被弃用),但它只提供了一种格式化验证值的方式。现在你可以插值约束注解参数,并通过点表示法导航对象。你甚至可以有条件性的消息。这里有一些例子

    # ternary operator for conditional DecimalMax constraints - see also HV-256
    javax.validation.constraints.DecimalMax.message  = must be less than ${inclusive == true ? 'or equal to ' : ''}{value}

    # a custom date range annotation with custom formatted validated date
    com.acme.DateRange.message = the specified date ${formatter.format('%1%tY-%tm-%td', validatedValue)} lies not between formatter.format('%1%tY-%tm-%td', min)} and formatter.format('%1%tY-%tm-%td', max)}
下周至少还有一次Hibernate Validator的发布。请保持关注。

享受吧!


回到顶部