找不到spring3 mvc @Valid批注

问题描述:

我尝试使用@Valid批注,但是eclipse总是会出现"Valid无法解析为类型"错误.我正在使用spring3库.

I try to use @Valid annotation, but eclipse always gives the "Valid cannot be resolved to a type" error. I m using the spring3 library.

我已经将hibernate-validator-4.1.0.Final.jar导入到我的WEB-INF/lib目录中.但是,这不能解决问题.

I have imported hibernate-validator-4.1.0.Final.jar into my WEB-INF/lib directory. however, this does not solve the problem.

感谢您的帮助!

据我所知,@Valid批注是Validation-api JAR的一部分,您可以在Hibernate Validator的lib目录中找到它.已经下载了Hibernate实现. @Valid是javax.validation注释API的一部分.您可以将此JAR添加到您的类路径中,以便能够正确引用注释.

As far as I remember the @Valid annotation is part of the validation-api JAR which you can find in the lib directory of the Hibernate Validator, as you have already downloaded the Hibernate implementation. The @Valid is a part of the javax.validation annotation API. You can add this JAR to your class path to be able to properly reference the annotation.