{"id":26171538,"url":"https://github.com/hall-wong/springspecificationbuilder","last_synced_at":"2026-05-25T00:03:06.046Z","repository":{"id":57719865,"uuid":"156420539","full_name":"hall-wong/SpringSpecificationBuilder","owner":"hall-wong","description":"Spring Specification Builder","archived":false,"fork":false,"pushed_at":"2021-05-15T09:29:16.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-05-25T06:26:55.217Z","etag":null,"topics":["java-8","spring-data-jpa"],"latest_commit_sha":null,"homepage":null,"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/hall-wong.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}},"created_at":"2018-11-06T17:21:48.000Z","updated_at":"2021-05-15T09:29:18.000Z","dependencies_parsed_at":"2022-09-26T21:41:08.371Z","dependency_job_id":null,"html_url":"https://github.com/hall-wong/SpringSpecificationBuilder","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hall-wong%2FSpringSpecificationBuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hall-wong%2FSpringSpecificationBuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hall-wong%2FSpringSpecificationBuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hall-wong%2FSpringSpecificationBuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hall-wong","download_url":"https://codeload.github.com/hall-wong/SpringSpecificationBuilder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243099858,"owners_count":20236276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-8","spring-data-jpa"],"created_at":"2025-03-11T19:35:14.891Z","updated_at":"2025-12-25T00:40:46.132Z","avatar_url":"https://github.com/hall-wong.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpringSpecificationBuilder\n欢迎使用Spring Specification Builder，\n本项目旨在减少开发人员在对Specification对象构建时的繁琐而单调的操作。\n\n* 本项目在使用时需要继承SpringSpecificationBuilder，并通过泛型指定所要查询的持久类；\n* 通过对继承类加上注解来达到对继承类注册的功能。注册采用懒加载模式，并会校验查询条件的合理性；\n* SpringSpecificationBuilder中的`set`方法，通过反射来保持代码的动态性，使得继承类不需要声明查询所需的字段；\n* 通过`build`方法获取Specification实例，这个实例是由SpringSpecificationImpl实现的。\n\n具体使用方式如下：\n\n```\n@QueryRequirement(restrictions = {@Restriction(field = \"myField\",operator = Operator.NotNull)})\npublic class MySpecificationBuilder\u003cMyEntity\u003e extends SpringSpecificationBuilder{\n    public static void main(String[]args){\n        Specification\u003cMyEntity\u003e spec = new MySpecificationBuilder().set(\"myField\").build();\n        //使用spec对象进行查询\n    }\n}\n```\n\n_English part is translate by Google_\n\nWelcome to the Spring Specification Builder, this project is designed to reduce the tedious and monotonous operation of developers in the construction of the Specification instance.\n\n* This project needs to inherit SpringSpecificationBuilder when it is used, and specify the persistent class to be queried through generics.\n* The function of registering an inherited class is achieved by annotating the inherited class. Registration uses lazy loading mode and will verify the reasonableness of the query conditions.\n* The set method in SpringSpecificationBuilder keeps the dynamics of the code through reflection, so that the inherited class does not need to declare the fields required by the query.\n* Get the Specification instance through the build method, which is implemented by SpringSpecificationImpl.\n\nExample code as following:\n\n```\n@QueryRequirement(restrictions = {@Restriction(field = \"myField\",operator = Operator.NotNull)})\npublic class MySpecificationBuilder\u003cMyEntity\u003e extends SpringSpecificationBuilder{\n    public static void main(String[]args){\n        Specification\u003cMyEntity\u003e spec = new MySpecificationBuilder().set(\"myField\").build();\n        //Query with the specification instance\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhall-wong%2Fspringspecificationbuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhall-wong%2Fspringspecificationbuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhall-wong%2Fspringspecificationbuilder/lists"}