Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import javax.validation.constraints.NotEmpty; not working [duplicate]

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?

like image 311
kaido Avatar asked Jan 01 '23 01:01

kaido


1 Answers

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

like image 50
Jakob Em Avatar answered Jan 13 '23 14:01

Jakob Em