曾遇到的问题
javax.validation.ValidationException: HV000183: Unable to load ‘javax.el.ExpressionFactory’
解决方案参考
梳理一下使用官方组件的科学方式
1.从官网hibernate.org查询组件对java的依赖
http://hibernate.org/orm/documentation/getting-started/
可知,5.2和高于5.2版本的hibernate-validator需要java 1.8
2.找到低于5.2的可用版本及使用方式
https://sourceforge.net/projects/hibernate/files/hibernate-validator/5.1.0.Final/
引用自官网简介,5.1.0.Final版本的组件使用方式如下:
Add the following to your Maven or Ivy dependency list (Hibernate Validator can be found in the JBoss Maven repository):
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.0.Final</version>
</dependency>
You also need an API and implementation of the Unified Expression Language. These dependencies must be explicitly added in an SE environment. In an EE environment they are often already provided.
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.4</version>
</dependency>
Bean Validation defines integration points with CDI. If your application runs in an environment which does not provide this integration out of the box, you may use the Hibernate Validator CDI portable extension by adding the following dependency:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-cdi</artifactId>
<version>5.1.0.Final</version>
</dependency>
3.了解[JSR-349 - Bean Validation 1.1]规范
上一步5.1.0.Final页面链接如下:
https://beanvalidation.org/1.1/