Reputation: 354
I am creating a REST controller which shall take a list of Dtos. It all works but the validation is not working, therefore it fails during persistence only.
My code:
@Valid @RequestBody HashMap<String, MyDto> myDtoMap
And unfortunately the MyDto does not get validated.
I also tried this way:
@Valid @RequestBody HashMap<String, @Valid MyDto> myDtoMap
Upvotes: 0
Views: 330
Reputation: 66
Please try :
annotate your controller with :
@RestController
@Validated
Then you can validate you class with :
@RequestBody HashMap<String, @Valid MyDto> myDtoMap
Upvotes: 4