Kotlin data class and bean validation with container element constraints

前端 未结 2 1294
难免孤独
难免孤独 2021-02-05 09:06

With Bean Validation 2.0 it is possible to also put constraints on container elements.

I cannot get this to work with Kotlin data classes:

data class Som         


        
2条回答
  •  温柔的废话
    2021-02-05 09:17

    Add this config to your build.gradle (note that ... means whatever is already there) :

    Groovy:

    compileKotlin {
        kotlinOptions {
            freeCompilerArgs = [..., "-Xemit-jvm-type-annotations"]
            ...
        }
    }
    

    Kotlin DSL:

    tasks.withType {
        kotlinOptions {
            freeCompilerArgs = listOf(..., "-Xemit-jvm-type-annotations")
            ...
        }
    }
    
    

提交回复
热议问题