类属性加上@JsonFormat的内容转义的整个过程是怎么处理的?

img


在类中上注解后,再到controller返回数据后,它是如何吧一个Date类型变成需要的类型?是通过反射加做的处理吗?

直接在javabean里面设置,参考:


@TableField("graduateDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date graduateDate;

LocalDateSerializer.createContextual方法,十有八九你也不会去看,没必要知道具体执行流程

img