注意新版的的springboot是默认不包含hibernate validator的,不能单独导入hibernate validator的包,否者就算你使用了有时候也会出现类似javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint的异常。 而应该导入springboot提供的maven依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>