解决使用Mybatis出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String

03-11 阅读 0评论

前排提醒注意文章时限!本文写于2024.1.9

解决使用Mybatis出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String,解决使用Mybatis出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,使用,管理,功能,第1张
(图片来源网络,侵删)

问题描述:

在springboot中使用Mybatis出现Invalid value type for attribute 'factoryBeanObjectType': java.lang.String

问题分析:

通过多方查询,一般为Spring Framework(Springboot)、Mybatis-Spring、MyBatis三者版本管理冲突

相关版本兼容性请查询: mybatis-spring官网解决使用Mybatis出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String,icon-default.png?t=N7T8,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,使用,管理,功能,第2张https://mybatis.org/spring/zh/index.html

我错误使用的版本为:

Springboot:3.2.1

Spring Framework:6.1.2

Mybatis-Spring:3.0.2

解决使用Mybatis出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String,解决使用Mybatis出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,使用,管理,功能,第3张
(图片来源网络,侵删)

MyBatis:3.5.14

皆为我的IDEA默认或推荐的最新版本依赖

深究问题:

在查询版本兼容性文件后,认为不应该是版本兼容问题,但依旧出现使用mybatis就出现Invalid value type for attribute 'factoryBeanObjectType': java.lang.String此类错误。

尝试新建项目,排除变量,锁定问题。

在整个项目只有借助Mybatis操作数据库这一功能后,发现只要一使用@Mapper和@MapperScan等由Mybatis-Spring依赖中提供的注解,项目就会出现此类错误,锁定问题出现在Mybatis-Spring依赖。并在调整使用基础mybatis或mybatisplus依赖后错误消失。

发现原因:

Mybatis-Spring:3.0.2此版本存在不稳定性问题,与部分版本Spring Framework组件存在不兼容,但难以锁定是哪些组件之间存在问题(查询双方官网似乎并没有出现相关错误公告)

解决使用Mybatis出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String,解决使用Mybatis出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,使用,管理,功能,第4张
(图片来源网络,侵删)

解决:

手动配置依赖使用3.0.3版本Mybatis-Spring,或降级。

注意:

在本文写作时间,部分版本的IDEA中maven提示的Mybatis-Spring最新版本为3.0.2。

结论:

依赖盲目使用IDEA推荐的最新版,可能会出现类似问题。


免责声明
本网站所收集的部分公开资料来源于AI生成和互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复: 表情:
评论列表 (暂无评论,人围观)

还没有评论,来说两句吧...

目录[+]