{"id":36418693,"url":"https://github.com/stick-i/spel-validator","last_synced_at":"2026-01-11T17:01:35.707Z","repository":{"id":238126926,"uuid":"795938815","full_name":"stick-i/spel-validator","owner":"stick-i","description":"一个强大的 Java 参数校验包，基于 SpEL 实现，扩展自 jakarta.validation-api 包，用于简化参数校验，几乎支持所有场景下的参数校验。 ","archived":false,"fork":false,"pushed_at":"2025-12-19T08:55:53.000Z","size":2651,"stargazers_count":232,"open_issues_count":4,"forks_count":47,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-12-22T02:57:07.357Z","etag":null,"topics":["java","spel","spring-expression-language","validator"],"latest_commit_sha":null,"homepage":"https://spel-validator.sticki.cn/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stick-i.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-04T13:00:39.000Z","updated_at":"2025-12-19T08:54:54.000Z","dependencies_parsed_at":"2024-05-13T11:38:49.127Z","dependency_job_id":"f6d3b12b-a608-4eb7-b17a-a6643f1295c8","html_url":"https://github.com/stick-i/spel-validator","commit_stats":null,"previous_names":["stick-i/spel-validator"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/stick-i/spel-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stick-i%2Fspel-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stick-i%2Fspel-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stick-i%2Fspel-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stick-i%2Fspel-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stick-i","download_url":"https://codeload.github.com/stick-i/spel-validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stick-i%2Fspel-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28314259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","spel","spring-expression-language","validator"],"created_at":"2026-01-11T17:01:35.153Z","updated_at":"2026-01-11T17:01:35.702Z","avatar_url":"https://github.com/stick-i.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpEL Validator\n\n[![Coverage Status](https://coveralls.io/repos/github/stick-i/spel-validator/badge.svg?branch=main)](https://coveralls.io/github/stick-i/spel-validator?branch=main)\n[![Maven Central](https://img.shields.io/maven-central/v/cn.sticki/spel-validator-root.svg)](https://central.sonatype.com/search?q=g:cn.sticki%20a:spel-validator-root)\n[![license](https://img.shields.io/github/license/stick-i/spel-validator)](https://github.com/stick-i/spel-validator/blob/main/LICENSE)\n\n一个强大的 Java 参数校验包，基于 SpEL 实现，扩展自 jakarta.validation-api 包，用于简化参数校验，几乎支持所有场景下的参数校验。\n\n## 项目地址\n\n- GitHub：https://github.com/stick-i/spel-validator\n- Gitee：https://gitee.com/sticki/spel-validator\n- 项目文档：https://spel-validator.sticki.cn/\n\n## 特点\n\n- 简单易用，使用方式几乎与 jakarta.validation-api 一致，学习成本低，上手快。\n- 强大的参数校验功能，几乎支持所有场景下的参数校验。\n- 扩展自 jakarta.validation-api 包，只新增不修改，无缝集成到项目中。\n- 基于 SpEL（Spring Expression Language） 表达式，支持复杂的校验逻辑。\n- 支持调用 Spring Bean，可在表达式中使用注入过的 Spring Bean。\n- 校验时基于整个对象，支持对象内字段间的校验逻辑。\n- 支持自定义校验注解，可根据业务需求自定义校验逻辑。\n- 无需额外的异常处理，校验失败时会上报到 jakarta.validation-api 的异常体系中。\n\n## 支持的环境\n\nJDK8+\n\n## 交流群\n\n请添加微信号 `sticki6`，备注 `SpEL`，我拉你入群。\n\n## 它解决了什么问题？\n\n- 枚举值字段校验：\n  ```java\n  @SpelAssert(assertTrue = \" T(cn.sticki.enums.UserStatusEnum).getByCode(#this.userStatus) != null \", message = \"用户状态不合法\")\n  private Integer userStatus;\n  ```\n\n- 多字段联合校验：\n  ```java\n  @NotNull\n  private Integer contentType;\n  \n  @SpelNotNull(condition = \"#this.contentType == 1\", message = \"语音内容不能为空\")\n  private Object audioContent;\n  \n  @SpelNotNull(condition = \"#this.contentType == 2\", message = \"视频内容不能为空\")\n  private Object videoContent;\n  ```\n\n- 复杂逻辑校验，调用静态方法：\n  ```java\n  // 中文算两个字符，英文算一个字符，要求总长度不超过 10\n  // 调用外部静态方法进行校验\n  @SpelAssert(assertTrue = \"T(cn.sticki.util.StringUtil).getLength(#this.userName) \u003c= 10\", message = \"用户名长度不能超过10\")\n  private String userName;\n  ```\n\n- 调用 Spring Bean（需要使用 @EnableSpelValidatorBeanRegistrar 开启Spring Bean支持）：\n  ```java\n  // 这里只是简单举例，实际开发中不建议这样判断用户是否存在\n  @SpelAssert(assertTrue = \"@userService.getById(#this.userId) != null\", message = \"用户不存在\")\n  private Long userId;\n  ```\n\n- 更多使用场景，欢迎探索和补充！\n\n## 📦 快速开始\n\n在线文档：https://spel-validator.sticki.cn/guide/getting-started.html\n\n## 📦 示例项目\n\n- [spel-validator-example](https://github.com/stick-i/spel-validator-example)\n\n## 🤝 贡献指南\n\n非常欢迎您来参与项目贡献，但希望您可以先在 issue 中提出您的想法，我们可以一起讨论，然后再进行代码编写。\n\n### 分支说明\n\n- `main`：主分支，已发布的最新版本代码将合入此分支。\n- `vX.Y.Z`：版本分支，用于汇总及验证新版本的功能，已经发布的版本会将分支删除。\n- `dev-num-desc`：开发分支，用于开发新功能，每个dev分支都应当对应一个issue，功能开发完成后通过PR合入 `vX.Y.Z` 分支，并删除当前分支。\n- `docs`：文档分支，修改文档的内容将提交到这里。\n\n## License\n\n[Apache-2.0](https://github.com/stick-i/spel-validator/blob/main/LICENSE)\n\n## 📧 联系作者\n\n- Email: sticki@126.com\n- 微信: sticki6\n- 公众号: 程序员阿杆\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=stick-i/spel-validator\u0026type=Date)](https://www.star-history.com/#stick-i/spel-validator\u0026Date)\n\n## 💰 捐赠支持\n\n| 微信赞赏                                                 | 支付宝赞赏                                            |\n|------------------------------------------------------|--------------------------------------------------|\n| ![微信](./document/image/wechat-appreciation-code.jpg) | ![支付宝](./document/image/alipay-receipt-code.jpg) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstick-i%2Fspel-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstick-i%2Fspel-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstick-i%2Fspel-validator/lists"}