Loading

Spring boot 返回参数移除null属性

注解
@JsonInclude(JsonInclude.Include.NON_NULL)

在实体类上加入此注解,可以剔除掉不需要的null属性

示例

@JsonInclude(JsonInclude.Include.NON_NULL)
public class ImprovementReceipt extends BaseEntity {
    private Long rectificationid;
    private Long sastaskid;
    private Long sasprojectid;
    private Long sasprojectcontentid;
    private Long sascontentscoreid;
}
在api返回时null的属性将不会返回给前端接受
posted @ 2020-12-07 16:25  oaifree  阅读(558)  评论(0编辑  收藏  举报