找不到spring3 mvc @Valid批注 [英] spring3 mvc @Valid annotation cannot be found

查看:104
本文介绍了找不到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.

这篇关于找不到spring3 mvc @Valid批注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆