我是靠谱客的博主 要减肥巨人,这篇文章主要介绍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内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复