前端传yyyy-MM-dd格式的String数据到后端用Date类型接受报错解决方法

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

在实体类上的属性加上上面两行注解即可

猜你喜欢

转载自blog.csdn.net/a1085578081/article/details/107338886