Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring验证集合错误_Java_Spring_Validation_Collections - Fatal编程技术网

Java Spring验证集合错误

Java Spring验证集合错误,java,spring,validation,collections,Java,Spring,Validation,Collections,我在用Spring验证数组列表时遇到问题 休息服务 public ResponseEntity<?> editPeople(@RequestBody List<Person> people, BindingResult result ){ .... } 验证器 public class personValidator implements Validator { @Override public boolean supports(Class<?&

我在用Spring验证数组列表时遇到问题

休息服务

public ResponseEntity<?> editPeople(@RequestBody List<Person> people, BindingResult result ){
....
}
验证器

public class personValidator implements Validator {

    @Override
    public boolean supports(Class<?> clazz) {
        return Person.class.equals(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
         ValidationUtils.rejectIfEmpty(errors, "name", "name.empty");
    }
}
你知道怎么解决这个问题吗?
提前谢谢

你能发布人物Pojo吗?@netta我现在添加了Pojo这是一个猜测,但可能尝试将int改为整数
public class personValidator implements Validator {

    @Override
    public boolean supports(Class<?> clazz) {
        return Person.class.equals(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
         ValidationUtils.rejectIfEmpty(errors, "name", "name.empty");
    }
}
"Invalid property 'id' of bean class [java.util.ArrayList]: Bean property 'id' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?",