엄지월드

@Valid import 에러 본문

java/Spring

@Valid import 에러

킨글 2022. 7. 22. 10:30
반응형

@Valid를 사용하려고 하니, 자동으로 import가 안되는 현상이 있었다.

그래서 직접 import javax.validation.Valid; 를 입력해주었지만, 그래도 에러가 나고 있었다.

찾아본 결과, build.gradle에서 implementation이 안되고 있어서 추가해주니 정상 작동하는 것을 확인할 수 있었다.

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-validation'
}

 

전체 build.gradle 내용

plugins {
	id 'org.springframework.boot' version '2.6.4'
	id 'io.spring.dependency-management' version '1.0.11.RELEASE'
	id 'java'
}

group = 'com.account'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-validation'
    
    
	implementation 'org.springframework.boot:spring-boot-starter'
	implementation 'org.redisson:redisson:3.17.1'
	implementation ('it.ozimov:embedded-redis:0.7.3'){
		exclude group: "org.slf4j", module: "slf4j-simple"
	}
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	compileOnly 'org.projectlombok:lombok'
	runtimeOnly 'com.h2database:h2'
	annotationProcessor 'org.projectlombok:lombok'
    implementation 'org.projectlombok:lombok:1.18.22'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
	useJUnitPlatform()
}
Comments