SpringMVC @JsonDeserialize不起作用

时间:2014-06-03 17:11:30

标签: spring-mvc jackson deserialization

我有一个非常简单的POJO如下:

@Entity
@Table(name = "people")
public class People(){

   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   private Integer peopleId;

   private Date birthday;

   @JsonDeserialize(using = DateDeserializer.class)
   public void setBirthday(Date birthday){
     this.birthday = birthday;
   }
}

DateDeserializer

public class DateDeserializer extends JsonDeserializer<Date> {

    @Override
    public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        System.out.print("abc2222222222222222222222222222");
        return new Date();
    }
}

然而,根本没有调用这个反序列化器,我测试了 @JSonSerializer ,它完美无缺。有什么我做错了或错过了什么?

0 个答案:

没有答案