6

I currently have a java/spring-boot application where I changed the version (in code) from 2.1.4 to 2.3.0 but as a result I've come across the error error: package javax.validation.constraints does not exist when trying to run a clean build - this comes from a import javax.validation.constraints.NotEmpty; line I have in my code - does anyone know how to resolve this issue to the code compiles/builds successfully?

kaido
  • 321
  • 1
  • 5
  • 15
  • 1
    Have you seen [this part of the Spring Boot 2.3 Release Notes](https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes#validation-starter-no-longer-included-in-web-starters) ? – wjans Jun 02 '20 at 12:35

1 Answers1

16

The Validation Starter dependency is no longer included in the web starter dependencies. Therefore you need to add it manually to your gradle file:

  implementation 'org.springframework.boot:spring-boot-starter-validation'

This is mentioned in the release notes:

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3.0-M1-Release-Notes#validation-starter-no-longer-included-in-web-starters

Jakob Em
  • 1,032
  • 9
  • 19