Kotlin doesn't play nice with Beans Validation annotations and this needs to be addressed
Spring and Spring Boot are what I would call “kotlin-friendly” frameworks. However, the beans validation aspect specifically just doesn’t play nice with kotlin. Here’s why.
Let’s assume the following data class:
data class UserDTO(
@jakarta.validation.constraints.Size(max = 10)
val username: String
)
… and the following REST controller:
@RestController
class UserRestController {
@PostMapping("/users")
@ResponseBody
fun saveUser(@RequestBody @jakarta.validation.Valid...