Springboot核心技术

Springboot返回的json屏蔽某些属性

2017-10-15  本文已影响18人  老胡聊聊天

entity上增加@JsonIgnoreProperties注解,标记需要忽略的属性,支持多个

@Entity
@JsonIgnoreProperties(value={"status","updateTime"})
public class GoldSell implements Serializable{

还有一种方式,直接注解在具体的property上,效果一样

@JsonIgnore
private Integer status;

不过这两种都是影响属性,会影响所有的接口,如果有的接口需要有的不需要呢?

上一篇 下一篇

猜你喜欢

热点阅读