Hibernate Validation of Collections of Primitives
问题 I want to be able to do something like: @Email public List<String> getEmailAddresses() { return this.emailAddresses; } In other words, I want each item in the list to be validated as an email address. Of course, it is not acceptable to annotate a collection like this. Is there a way to do this? 回答1: Neither JSR-303 nor Hibernate Validator has any ready-made constraint that can validate each elements of Collection. One possible solution to address this issue is to create a custom