I am using javax.validation for validating request in an API developed using spring. I have to validate List<Integer> so that all values must be a positive number and size of the list must be exactly equal to some fix number e.g. 2. Valid request should be [ 1,2] Invalid request should be [-1,2] or [1,2,3] Answer EDIT: Just realized how