elvis_ferns
elvis_ferns

Reputation: 524

Unresolve error for Validators in Spring boot - Kotlin

user.controller

fun createUser(@Valid() @RequestBody payload: Map<String, String>, @RequestHeader(value = "session") session: String): String { 
    /// code
}

build.gradle

implementation "org.springframework.boot:spring-boot-starter-web"

I am getting an error Unresolved reference: Valid I have added the starter project for the hibernate validator

I have no clue what I am missing?

Upvotes: 1

Views: 397

Answers (1)

Guildenstern70
Guildenstern70

Reputation: 1859

Validation is no longer included in recent versions of Spring Boot.

You must add

starter-validation

library:

Maven:

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-validation</artifactId>
</dependency>

Gradle:

 implementation("org.springframework.boot:spring-boot-starter-validation")

Upvotes: 3

Related Questions