My Spring Boot validation only works if I use the annotation like this (I use Kotlin):
@valid:NotEmpty(message = "Please enter a value")
So for example:
data class RandomDto(
@valid:NotEmpty(message = "Please enter a value")
var randomValue: String
)
If I use this it won't work:
@NotEmpty(message = "Please enter a value")
Why is this? I annotated the controller function parameter with @Valid
.
Thanks in advance.