spring 实体类定义的字段不能从数据读取

实体类上定义的日期字段,插入数据库时没问题,但是当读取出来时报映射错误,不能从类型LocalDate转换到Date类型:

No converter found capable of converting from type [java.time.LocalDate] to type [java.util.Date]

完整报错如下:

解决方法:

  • 把字段的类型从Date类型换成LocalDate类型就能读取

有知道为什么的老铁给我留言



来自为知笔记(Wiz)


posted on 2022-06-22 00:58  白衣风云  阅读(130)  评论(0编辑  收藏  举报

导航