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