//对field(所有字段)进行过滤 //对get方法进行过滤 //对isBoolean这样的方法进行过滤 //里面的具体配置有 ANY,DEFAULT,NON_PRIVATE,NONE,PROTECTED_AND_PUBLIC,PUBLIC_ONLY //分别对不同的情况进行设置,看字面就能理解 不解释 //@JsonIgnore 对某个属性进行忽略,不参与序列化(该注解放在属性上) @JsonAutoDetect(getterVisibility=Visibility.PUBLIC_ONLY, fieldVisibility=Visibility.ANY, isGetterVisibility=Visibility.ANY) public class User { private int id; private Date birthday; private double money; private String name; public User() { } public User(int id, String name, Date birthday) { super(); this.id = id; this.name = name; this.birthday = birthday; } public User(int id, String name, double money, Date birthday) { super(); this.id = id; this.name = name; this.money = money; this.birthday = birthday; } //@JsonIgnore 对某个属性进行忽略,不参与序列化 public Date getBirthday() { return birthday; } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getMoney() { return money; } public String getName() { return name; } public void setBirthday(Date birthday) { this.birthday = birthday; } public void setMoney(double money) { this.money = money; } public void setName(String name) { this.name = name; } }