简体   繁体   中英

kotlin data class with annotations, why @DateTimeFormat annotation works without targetting

data class UserSearchRequest(
        @field:NotNull
        val active: Boolean?,
        // no targeting work
        @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) 
        @field:NotNull
        val registeredDate: LocalDate,
)

why @DateTimeFormat annotation works without targetting?

you registered kotlin module, it allows you to apply jackson annotations to constructor params without targeting but it doesn't work for java validation like your NotNull annotations

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM