springboot mybatis Java.lang.ClassCastException

参考

项目使用spring boot 集成mybatis通用mapper插件,发现查询方法selectOne

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

 

增删改都没问题 只有查询报错

 

解决方法如下:

创建目录

  resource

    META-INF

      spring-devtools.properties 

 

加入以下代码

restart.include.companycommonlibs=tk/mybatis.*

 

相关文章

https://blog.csdn.net/isea533/article/details/70495714

 

 

我的问题类似

 

处理方法

springboot mybatis Java.lang.ClassCastException_第1张图片

restart.exclude.pig-common=/pig-common/target/classes/

说明:

    1)修改当前工程,不需要重新加载当前工程依赖的项目,所以在此配出掉;

    2)为啥路径这样设置呢,我是根据项目启动日志

"C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:52149,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=52148 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:D:\IDEA\lib\rt\debugger-agent.jar=file:/C:/Users/shangwu/AppData/Local/Temp/capture.props -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_181\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\rt.jar;D:\Development\pig\code\pig\pig-modules\pig-upms-service\target\classes;D:\Development\pig\code\pig\pig-common\target\classes;D:\Java\MavenlRepository\repo\io\jsonwebtoken\jjwt\0.9.0\jjwt-0.9.0.jar;D:\Java\MavenlRepository\repo\org\springframework\boot\spring-boot-starter-data-redis\1.5.12.RELEASE\spring-boot-starter-data-redis-1.5.12.RELEASE.jar;D:\Java\MavenlRepository\repo\org\springframework\data\spring-data-redis\1.8.11.RELEASE\spring-data-redis-1.8.11.RELEASE.jar;D:\Java\MavenlRepository\repo\org\springframework\data\spring-data-keyvalue\1.2.11.RELEASE\spring-data-keyvalue-1.2.11.RELEASE.jar;D:\Java\MavenlRepository\repo\org\springframework\data\spring-data-commons\1.13.11.RELEASE\spring-data-commons-1.13.11.RELEASE.jar;D:\Java\MavenlRepository\repo\org\springframework\spring-tx\4.3.16.RELEASE\spring-tx-4.3.16.RELEASE.jar;D:\Java\MavenlRepository\repo\org\springframework\spring-oxm\4.3.16.RELEASE\spring-oxm-4.3.16.RELEASE.jar;D:\Java\M

你可能感兴趣的:(springboot mybatis Java.lang.ClassCastException)