部署服务器项目报错
Error creating bean with name ‘org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0’
Caused by: javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like hibernate Validator (RI) to your classpath.
错误原因:是因为我们在使用javax.validation的时候,还需要一个javax.validation的实现包,因为validation只是一个协议,可以使用hibernate-validator这个实现包,完整的使用如下:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>