Error in Java Import statement "The import javax.validation.constraints.NotNull cannot be resolved"
The jar containing this class must be added to the build path of your project: http://mvnrepository.com/artifact/javax.validation/validation-api/1.0.0.GA
I had the same problem. I found out that the recent versions of Spring Boot needs the separate dependency for Validation. I Tried adding below dependency in pom.xml file and it worked.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
for JDK-9 the old version of "javax.validation" is not supporting. So we should add latest version.
we will know the latest version of any jar the following way
C:\Users\username\.m2\repository\javax\validation\validation-api
The above folder should have all versions of the jar, then you can add the latest version as dependency in the pom.xml file the following way
In my case "2.0.0.final" is the latest version.
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.0.Final</version>
</dependency>