項目使用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