jsr380

bean validation not working with kotlin (JSR 380)

℡╲_俬逩灬. 提交于 2020-01-02 00:13:28
问题 so first of all i could not think of a better title for this question so i'm open for changes. I am trying to validate a bean using the bean validation mechanism (JSR-380) with spring boot. So i got a controller like this: @Controller @RequestMapping("/users") class UserController { @PostMapping fun createUser(@Validated user: User, bindingResult: BindingResult): ModelAndView { return ModelAndView("someview", "user", user) } } with this being the User class written in kotlin: data class User(

bean validation not working with kotlin (JSR 380)

牧云@^-^@ 提交于 2019-12-04 22:51:28
so first of all i could not think of a better title for this question so i'm open for changes. I am trying to validate a bean using the bean validation mechanism (JSR-380) with spring boot. So i got a controller like this: @Controller @RequestMapping("/users") class UserController { @PostMapping fun createUser(@Validated user: User, bindingResult: BindingResult): ModelAndView { return ModelAndView("someview", "user", user) } } with this being the User class written in kotlin: data class User( @field:NotEmpty var roles: MutableSet<@NotNull Role> = HashSet() ) and this being the test: @Test