1、全局配置

spring.jackson.default-property-inclusion=non_null

2、局部使用

@JsonInclude(JsonInclude.Include.NON_NULL) 
public class OrderTransport { 
    private String name; 
    private Integer age;
}

风里有诗句
29 声望3 粉丝