SpringBoot启动报错Error creating bean with name 'xx': Unsatisfied dependency expressed through field xx
错误如下:
2020-05-11 08:55:21.333 WARN 937516 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory
.UnsatisfiedDependencyException: Error creating bean with name 'demoController': Unsatisfied dependency expressed through field 'userServiceImpl'; nested exception is org.springframework.beans.factory
.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating
bean with name 'userMapper' defined in file [D:\Code\QMSPull\demo\target\classes\com\multiple\demo\dao\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean
instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory'
threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml]'; nested exception is org.apache.ibatis
.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml]'. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already
contains value for com.multiple.demo.dao.UserMapper.selectByPrimaryKey. please check file [D:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml] and file [D:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml]
然后我开始以下排查
- 检查各层注解
a. Collector层
b. Service层
c. SpringbootApplication是否开启包扫描或者dao层是否有@Mapper - 检查mapper.xml 中mapper标签指向的dao是否正确
mapper.xml中方法是否在Dao层声明过。
看到报错中有一条:
java.lang.IllegalArgumentException: Mapped Statements collection already
contains value for com.multiple.demo.dao.UserMapper.selectByPrimaryKey. please check file [D:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml] and file
后来我去查看UserMapper.xml (dao层对应mapper.xml文件)
两个sql ,id相同。
修改id即可
SpringBoot启动报错Error creating bean with name 'xx': Unsatisfied dependency expressed through field xx相关推荐
- 报错-Error creating bean with name xxx: Unsatisfied dependency expressed through field xxx
报错异常: Error creating bean with name 'loginController': Unsatisfied dependency expressed through fiel ...
- Error creating bean with name ,Unsatisfied dependency expressed through field
今天打开idea发现项目跑不起来了,一直报这个错 org.springframework.beans.factory.UnsatisfiedDependencyException: Error cre ...
- 解决异常Error creating bean with name ‘xxxxxController‘: Unsatisfied dependency expressed through field
今天来聊一下常见的异常,异常信息如下图所示: 错误信息如下: Error creating bean with name 'helloController': Unsatisfied dependen ...
- SpringBoot启动报错Error creating bean with name 'projectingArgumentResolverBeanPostProcessor'
这个错误 Error creating bean with name 'projectingArgumentResolverBeanPostProcessor' 发生的原因:切入点错误 @Aspect ...
- Error creating bean with name ‘permissionController‘: Unsatisfied dependency expressed through fiel
错误提示: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with nam ...
- Error creating bean with name ‘marketCluesController‘: Unsatisfied dependency expressed through fiel
忘记实service了 Error creating bean with name 'marketCluesController': Unsatisfied dependency expressed ...
- 记录报错:Error creating bean with name ‘indexServiceImpl‘: Unsatisfied dependency expressed through fiel
在做项目时,运行时出现了以下报错 报错的原因就是创建indexController这个bean出错了,嵌套异常是itemService不满足依赖,容器里面没有类型为"com.example. ...
- activiti-explorer 启动报错 Error creating bean with name 'demoDataConfiguration'
来源:http://blog.csdn.net/huangning2/article/details/9247099 Activiti database setup As said in the on ...
- Error creating bean with name esProductServiceImpl Unsatisfied dependency expressed through fiel
以上报错本质涉及:Springboot2.x.x中elasticsearch的版本号对应关系 在springboot 的pom中 parent.version 版本号为 <version> ...
最新文章
- php中的unlink(),unset(),rmdir()删除函数
- guava之ComparisonChain
- 微软虚拟化平台现在可以管理VMware!
- 五、开始学习Excel函数,效率快速提高
- XCTF-MISC-新手区-如来十三掌
- IOS之storyBoard的storyboard_reference的使用
- java经典设计模式4,JAVA设计模式(4) 之装饰设计模式
- mysql选取最小值_MySQL:选择x最小值
- 18-mysql-数据类型
- python中int什么意思_python3中int(整型)的使用教程
- 监督学习与非监督学习
- Linux 命令执行流程
- Python return语句 函数返回值
- [知了堂学习笔记]_IO流之File类的应用
- 浅谈利用强化学习A3C玩转超级玛丽奥
- Xshell6 plus绿色永久版_SSH连接工具_站长必备工具集
- electron最小化托盘、禁用右键菜单
- Android进程管理详解
- 手机IO workload解析
- 在网页中加入MSN、QQ以实现即时通讯