java.lang.ClassCastException: com.xx.User cannot be cast to com.xx.User

项目使用spring boot1.5.2 集成mybatis通用mapper插件,发现查询方法selectByPrimaryKey

会导致发生异常—— java.lang.ClassCastException:com.xxx.xxx.entity cannot be cast to com.xxx.xxx.entity

测试过:insert、update、delete方法都没有问题,就是查询出实体就报异常。后来到github看到这是插件的一个bug

解决方法如下:

在spring boot项目resources目录下创建一个META-INF文件夹,在META-INF目录下再创建一个
spring-devtools.properties 文件
加入以下代码即可解决
restart.include.companycommonlibs=tk/mybatis.*

原文链接地址:http://blog.csdn.net/jie873440996/article/details/70231260

猜你喜欢

转载自blog.csdn.net/luwei42768/article/details/79348918
今日推荐