{"id":15131491,"url":"https://github.com/dzw1113/multirequest","last_synced_at":"2026-01-19T12:33:29.120Z","repository":{"id":57733079,"uuid":"387976728","full_name":"dzw1113/multirequest","owner":"dzw1113","description":"解决RequestBody注解无法支持多个参数问题，传统形式必须封装对象，导致对象泛滥。同时解决request流反复读问题","archived":false,"fork":false,"pushed_at":"2021-07-21T07:56:42.000Z","size":71,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T21:12:05.506Z","etag":null,"topics":["java","requestbody","spring"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dzw1113.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-21T03:03:55.000Z","updated_at":"2023-08-23T02:23:30.000Z","dependencies_parsed_at":"2022-09-26T22:11:14.813Z","dependency_job_id":null,"html_url":"https://github.com/dzw1113/multirequest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dzw1113/multirequest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzw1113%2Fmultirequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzw1113%2Fmultirequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzw1113%2Fmultirequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzw1113%2Fmultirequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dzw1113","download_url":"https://codeload.github.com/dzw1113/multirequest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzw1113%2Fmultirequest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28567898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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","requestbody","spring"],"created_at":"2024-09-26T03:42:13.567Z","updated_at":"2026-01-19T12:33:29.105Z","avatar_url":"https://github.com/dzw1113.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting Started\n\nmaven引用\n\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.dzw1113\u003c/groupId\u003e\n    \u003cartifactId\u003emultirequest\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n---\n@RequestBody:并不能支持多个参数，当有多个参数时，必须封装成对象，较麻烦\n\n@MultiRequestBody:支持关系映射、多参数（基础类型、集合、对象），支持Spring Validated校验。支持Swagger2的话，需要额外配置代码。\n\n用法：\n在controller方法种直接引用：\n\n```\npublic HttpResult\u003cHdTodayReviewPO\u003e get(@MultiRequestBody HdTodayReviewQueryPO hdTodayReviewQueryPO) \n\npublic HttpResult check(@MultiRequestBody(required = true) Long id, @MultiRequestBody(required = true) String operationCode) {\n```\n\n---\n\n过滤器：BodyFilter,支持反复读取Request里的流，需自己注入到FilterRegistrationBean里。\n\n注入：\n```\n@Bean\n@Order(3)\npublic FilterRegistrationBean\u003cBodyFilter\u003e Filters() {\n    FilterRegistrationBean\u003cBodyFilter\u003e registrationBean = new FilterRegistrationBean\u003cBodyFilter\u003e();\n    registrationBean.setFilter(new BodyFilter());\n    registrationBean.addUrlPatterns(\"/*\");\n    registrationBean.setAsyncSupported(Boolean.TRUE);\n    registrationBean.setName(\"bodyFilter\");\n    return registrationBean;\n}\n```\n取法：\n\n```\nHttpServletRequest request = servletRequestAttributes.getRequest();\njsonBody = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8);\nRequestUtils.getRequest().setAttribute(\"JSON_REQUEST_BODY\", jsonBody);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzw1113%2Fmultirequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdzw1113%2Fmultirequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzw1113%2Fmultirequest/lists"}