javax.validation.ValidationException:HV000183:无法加载'javax.el.ExpressionFactory'
我尝试使用休眠验证器编写非常简单的应用程序: 我的步骤: 在pom.xml中添加以下依赖项: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>5.1.1.Final</version> </dependency> 编写代码: class Configuration { Range(min=1,max=100) int threadNumber; //... public static void main(String[] args) { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); Validator validator = factory.getValidator(); Configuration configuration = new Configuration(); configuration.threadNumber = 12; //... Set<ConstraintViolation<Configuration>> constraintViolations = validator.validate(configuration); System.out.println(constraintViolations); } } 我得到以下stacktrace: Exception in thread …