Got it.
Click OK
THEN:
You just need to add the dependency Validation API in the pom.xml :
<dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>2.0.0.Final</version> </dependency>
What build tool do you use? You obviously forgot to declare your dependencies, that's why IDEA doesn't know where to look for the classes you are trying to import.
You just need to add spring-boot-starter-validation
dependency in build.gradle
file
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
}
Try this,
Step-by-step:
Open "build.gradle" file. It's in your root folder project;
Include the line below inside "dependencies{ }": implementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
Save and close build.gradle file;
Next, you will see a short notification on the top of your screen to "Load Gradle Changes". Click on it.
If you don't see any notification, click on Gradle side bar, and then click on "Reload All Gradle Projects".
If you get this error after attempting to import a Maven project, it may be that you need to check "Import Maven projects automatically" in the Import Project wizard. Without that the IntelliJ build may not be able to locate Maven dependencies, even if they are declared in pom.xml files.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.