spring boot过滤null值

it2022-05-09  63

1.全局,若是以下格式,注意jackson的缩进!

spring:datasource: driver-class-name: com.mysql.cj.jdbc.Driver username: root password: 123456 url: jdbc:mysql://192.168.1.121/shopping?characterEncoding=utf-8&useSSL=false jpa: show-sql: truejackson: default-property-inclusion: non_null  

2.局部,在需要的类前面添加以下标红的注解

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

 

转载于:https://www.cnblogs.com/slp127/p/10112845.html

相关资源:数据结构—成绩单生成器

最新回复(0)