Error in Java Import statement “The import javax.validation.constraints.NotNull cannot be resolved”

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>

Leave a Comment