Hibernate JPA中@Transient、@JsonIgnoreProperties、@JsonIgnore、@JsonFormat、@JsonSerialize等注解解释

﹏ヽ暗。殇╰゛Y 2023-01-08 13:25 247阅读 0赞

1、@JsonIgnoreProperties
此注解是类注解,作用是json序列化时将java bean中的一些属性忽略掉,序列化和反序列化都受影响。

写法将此标签加在model 类的类名上 ,可以多个属性也可以单个属性

  1. //生成json时将name和age属性过滤
  2. @JsonIgnoreProperties({ "name"},{ "age"})
  3. public class user {
  4. private String name;

发表评论

表情:
评论列表 (有 0 条评论,247人围观)

还没有评论,来说两句吧...

相关阅读