如果WEB-INF / lib中缺少Validator Api,为什么@Valid不起作用也不抛出异常?

时间:2018-09-28 03:10:44

标签: spring-mvc hibernate-validator

请参阅何时尝试加载Validator进行验证,如果WEB-INF / lib中缺少Validator Api,它将抛出ClassNotFoundException,但是@Valid不会抛出这样的错误功能,为什么呢?

///如果WEB-INF / lib中缺少Validator Api(但在构建路径中可用)

1)Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); //ClassNotFoundException error

2)public ModelAndView signupValidate(@Valid @ModelAttribute("ma_Student") StudentTO Student{...} //neither work nor error

0 个答案:

没有答案