@validate手动校验 - 解决service层无法校验的问题

    private static void validate(Object o) {
        Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
        Set<ConstraintViolation<Object>> set = validator.validate(o);
        for (ConstraintViolation<Object> constraintViolation : set) {
            throw new IllegalArgumentException(constraintViolation.getMessage());
        }
    }
上一篇:格式校验工作 Hibernate Validator


下一篇:部署 Solana 验证节点