I have a question about applying bean validation 2.0

I am applying bean validation 2.0 in my project.

When I apply the following part of the bean validation2.0 function, it works in java but not in kotlin.

support for validating container elements by annotating type arguments of parameterized types e.g. List<@Positive Integer> positiveNumbers. This also includes:

Below is the code I tested:

@SpringBootTest(classes = arrayOf(Application::class))
class FooTest {
lateinit var fooService: FooService

    fun test() {
        var foo = Foo()

class FooService {
    fun foo(@Valid foo: Foo) {


class Foo {
    var values: MutableList<@Min(10) Int> = mutableListOf()

public class Foo {
    List<@Min(10) Integer> values = new ArrayList();

Why does not it work in kotlin?
Thank you.

1 Like

I ran into the same issue and described it here - spring mvc - Kotlin data class and bean validation with container element constraints - Stack Overflow

I also came up with a sample project to reproduce the case:

Any ideas on this?