一般在使用mybatis的mapper的映射文件中,我们一般使用java.util.Date使用最为映射,但是如果使用LocalDateTime类型就会报错,如下:
Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException:
nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalStateException: No typehandler found for property createdTime
原因: mybatis低版本没有携带 LocalDateTime类型转换器
解决:可以通过添加依赖解决
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-typehandlers-jsr310</artifactId>
</dependency>