我是靠谱客的博主 要减肥巨人,最近开发中收集的这篇文章主要介绍It was either not specified and/or could not be found for the javaType (java.time.LocalDateTime),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

总所周知,localdatetime是jdk8 推出的关于日期计算非常方便地一个类,一旦开始用上就欲罢不能。但是在使用的时候,坑还是蛮多的。

一、mybatis与LocalDatetime

如果直接将实体里面所有的Date类型换成LocalDatetime之后,运行程序是会报异常的。此时,可以加入以下依赖:

<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-typehandlers-jsr310</artifactId>
<version>1.0.2</version>
</dependency>

在mybatis3,.4以上,加入该依赖即可生效。mapper等跟之前一样无需修改。

最后

以上就是要减肥巨人为你收集整理的It was either not specified and/or could not be found for the javaType (java.time.LocalDateTime)的全部内容,希望文章能够帮你解决It was either not specified and/or could not be found for the javaType (java.time.LocalDateTime)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(101)

评论列表共有 0 条评论

立即
投稿
返回
顶部