Is NotNull needed on Kotlin?
问题 I have a class: class User( var name: String ) And a mapped post request: @PostMapping("/user") fun test(@Valid @RequestBody user: User) { //... } What if a client will send a JSON of a user with name: null ? Will it be rejected by the MVC Validator or an exception will be throwed? Should I annotate name with @NotNull ? Unfortunately, I cannot check that because only can write tests (it is not available to create User(null) ). 回答1: You can avoid using @NotNull , as it'll never get triggered