All.
I want to use @Valid and @NotEmpty in the spring boot(2.3.0) framework.
But I was unable to import javax.validation
so I couldn't.
Here is the screen and build.gradle
file I am currently experiencing:
<File: build.gradle>
plugins {
id 'org.springframework.boot' version '2.3.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
}
group = 'kr.co.fastcampus'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
// Spring Boot
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
// Database
implementation 'com.h2database:h2'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
Might be problem with gradle cache.
Make sure you are using correct gradle version in gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip
Then do a rebuild. Check if you are getting any errors during build. Everything should be green here:
I used the same build.gradle file (which you provided), both @Valid and @NonEmpty annotations are working fine.