微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如果在get / set中指定@JsonProperty,如何生成文档

如何解决如果在get / set中指定@JsonProperty,如何生成文档

我在项目中添加了Springfox 2.9.2。 对于大多数方法,一切正常。例外是@JsonProperty中的getter-setter方法具有不同的值。

@ApiModel(value = "GetStatusResp",description = "Application status")
@Component
public class GetStatusResp {

    @ApiModelProperty(position = 1,value = "Error code",required = true,example = "0")
    int error;

    @ApiModelProperty(position = 2,value = "displays the current status of the order",example = "1")
    String status;

    @JsonProperty("error")
    public int getError() {
        return error;
    }

    @JsonProperty("ERROR")
    public void setError(int error) {
        this.error = error;
    }

    @JsonProperty("status")
    public String getStatus() {
        return status;
    }

    @JsonProperty("STATUS")
    public void setStatus(String status) {
        this.status = status;
    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。