Skip to content

统一格式参数解析 #45

Description

@sunnymaple

接口返回的参数通过ResponseBodyAdvice封装成统一格式的响应参数:
如:
接口返回Student对象(含有id,name 和age属性):
/**

  • 根据ID获取学生信息
  • @PARAM id 学生ID
  • @return
    */
    @GetMapping
    public Student getStudentById(Integer id){
    return new Student();
    }

接口看似返回json:
{
“id”:1,
"name":"张三",
"age":18
}

但是在ResponseBodyAdvice实现类中,被封装成了:
{
"errorCode":“00000”,
"message":"",
"result":{
“id”:1,
"name":"张三",
"age":18
}
}

是否可以支持这种封装

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions