前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeExce

Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeExce

作者头像
明明如月学长
发布2021-08-27 15:36:04
1.3K0
发布2021-08-27 15:36:04
举报
文章被收录于专栏:明明如月的技术专栏

mybatis和spring整合 出现如下错误:

代码语言:javascript
复制
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl':
 Injection of resource dependencies failed; 
 nested exception is org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name 'userMapper' defined in file [D:\Program Files\java\workspaces\IdeaWorkspace\WebChat\target\WebChat\WEB-INF\classes\com\lindasoft\mapper\UserMapper.class]:
 Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory';
 nested exception is org.springframework.beans.factory.BeanCreationException: 
 Error creating bean with name 'sqlSessionFactory' defined in URL [file:/D:/Program%20Files/java/workspaces/IdeaWorkspace/WebChat/target/WebChat/WEB-INF/classes/spring/applicationContext.xml]: 
 Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException

 没有其他详细的错误提示,感觉配置也没啥问题。卡住了好长时间,

 网上有提示spring 和mybatis版本可能不配

于是查询一下mybatis-spring的maven库,依赖的包的版本。

http://mvnrepository.com/artifact/org.mybatis/mybatis-spring/1.3.0

于是 看到mybatis-spring版本1.3.0和 mybatis   3.4.0 以及spring  4.2.5.RELEASE版本搭配

代码语言:javascript
复制
      org.mybatis
      mybatis
      3.4.0
    
    
      org.mybatis
      mybatis-spring
      1.3.0

最后修改为这几个版本,正常启动! done!

类似问题都可以按照这个思路来解决。

如果觉得本文对你有帮助,欢迎点赞评论,欢迎关注我,我将努力创作更多更好的文章。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016/07/06 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档