[英]Spring javax.validation problem
In my application with spring framework, I have this import which it couldn't find在我使用 spring 框架的应用程序中,我有这个找不到的导入
import javax.validation.Valid;
Thing is I already have that javax.jar in the classpath.问题是我已经在类路径中有那个 javax.jar。 So my question is is there a different version of javax.jar that has validation package or I need any other jar files?
所以我的问题是有不同版本的 javax.jar 有验证包还是我需要任何其他 jar 文件? I couldn't find any javax.jar that has validation package on the internet.
我在互联网上找不到任何具有验证包的 javax.jar。 So please give me a link if you know any.
所以如果你知道的话,请给我一个链接。 Thanks in advance!
提前致谢!
You're looking for javax.validation:validation-api .您正在寻找javax.validation:validation-api 。
Also, as Amir mentioned, if you've found stackoverflow useful, accept some answers.另外,正如 Amir 提到的,如果您发现 stackoverflow 很有用,请接受一些答案。 People will be more inclined to help out.
人们会更愿意帮忙。
If you are using maven, just add the external dependency in your pom.xml如果您使用的是 maven,只需在 pom.xml 中添加外部依赖项
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
Verify the latest version here: https://mvnrepository.com/artifact/javax.validation/validation-api在此处验证最新版本: https : //mvnrepository.com/artifact/javax.validation/validation-api
javax.validation.*
是jsr-303 的一部分,需要在这里单独下载。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.