{"id":32589156,"url":"https://github.com/deepexi/payload-spring-boot-starter","last_synced_at":"2026-02-25T18:05:17.338Z","repository":{"id":98816404,"uuid":"215009530","full_name":"deepexi/payload-spring-boot-starter","owner":"deepexi","description":"Unified the return value starter","archived":false,"fork":false,"pushed_at":"2023-05-26T22:25:20.000Z","size":41,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-30T00:53:56.073Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/deepexi.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,"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":"2019-10-14T10:04:08.000Z","updated_at":"2023-01-18T04:50:26.000Z","dependencies_parsed_at":"2023-05-25T14:00:22.523Z","dependency_job_id":null,"html_url":"https://github.com/deepexi/payload-spring-boot-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deepexi/payload-spring-boot-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepexi%2Fpayload-spring-boot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepexi%2Fpayload-spring-boot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepexi%2Fpayload-spring-boot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepexi%2Fpayload-spring-boot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepexi","download_url":"https://codeload.github.com/deepexi/payload-spring-boot-starter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepexi%2Fpayload-spring-boot-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29833763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T17:57:15.019Z","status":"ssl_error","status_checked_at":"2026-02-25T17:56:11.472Z","response_time":61,"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":[],"created_at":"2025-10-30T00:53:17.332Z","updated_at":"2026-02-25T18:05:17.332Z","avatar_url":"https://github.com/deepexi.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# payload-spring-boot-starter\n[![Build Status](https://travis-ci.org/deepexi/payload-spring-boot-starter.svg?branch=master)](https://travis-ci.org/deepexi/payload-spring-boot-starter) \n[![codecov](https://codecov.io/gh/deepexi/payload-spring-boot-starter/branch/master/graph/badge.svg)](https://codecov.io/gh/deepexi/payload-spring-boot-starter)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.deepexi/pojo-converter-spring-boot-starter.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.deepexi%22%20AND%20a:%22pojo-converter-spring-boot-starter%22)\n\n将项目中统一结果返回对象的相关内容抽离出来，封装成一个独立的starter，方便在Spring Boot至使用。\n\n## 版本信息\n基于 **Spring Boot：2.1.9.RELEASE** 构建\n\n## Getting Started\n  实现自定义的Converter，然后引入starter坐标后，调用ConverterUtils的方法即可进行转化，\n  具体使用参考[Test Demo](https://github.com/deepexi/payload-spring-boot-starter/tree/master/src/test/java/com/deepexi/payload)\n  \n  \n### 引入坐标\n  \n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.deepexi\u003c/groupId\u003e\n    \u003cartifactId\u003epayload-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0-release\u003c/version\u003e\n\u003c/dependency\u003e\n```\n     \n#### 配置\n见配置文件中 **spring.mvc.payload** 属性的自动提示\n可自定义返回属性名称\n```yaml\nspring:\n  mvc:\n    payload:\n      payload-map:\n        code: code\n        success: success\n        message: message\n        payload: payload\n```\n      \n\n ##### 统一结果 @Payload\n  \nController *@RestController* 类上使用 **@Payload** 注解，自动对返回的数据进行包装。\n\n ```java\n@Payload\n@RequestMapping(\"/users\")\n@RestController\npublic class MyController {\n\n    @GetMapping(\"/{id}\")\n    public User get(@PathVariable Integer id) {\n      return user;\n    }\n\n}\n\n```\n响应结果格式如下：\n```json\n{\n  \"code\": \"1\",\n  \"payload\": {\n     \"k1\": \"v1\",\n     \"k2\": \"v2\"\n  },\n  \"success\": true\n}\n```\n\n##### 异常处理  @BizErrorResponseStatus\n\n继承RuntimeException类，并加上 **@BizErrorResponseStatus(\"00000-0000-0001\")** 注解，值为自定义的错误码，\n异常消息参数message也会一同响应返回。\n\n```java\n@BizErrorResponseStatus(\"00000-0000-0001\")\npublic class CustomerException extends RuntimeException {\n   public CustomerException(String message){\n        super(message);\n   }\n}\n```\n\n响应结果格式如下：\n```json\n{\n    \"success\": false,\n    \"message\": \"message\",\n    \"code\": \"00000-0000-0001\"\n}\n```\n\n\n### TODO\n\n**扩展返回字段**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepexi%2Fpayload-spring-boot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepexi%2Fpayload-spring-boot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepexi%2Fpayload-spring-boot-starter/lists"}