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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM