解决异常Error creating bean with name ‘xxxxxController‘: Unsatisfied dependency expressed through field
解决异常Error creating bean with name ‘xxxxxController‘: Unsatisfied dependency expressed through field
Error creating bean with name 'datainteractionController': Unsatisfied dependency expressed through field 'busiSysInfoService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'busiSysInfoServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.**NoSuchBeanDefinitionException: No qualifying bean of type 'com.example.demo.mapper.BusiSysInfoMapper' available**: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
创建dataInteractionController这个bean出错,嵌套异常是busiSysInfoService不满足依赖,容器里面没有com.example.demo.mapper.BusiSysInfoMapper 的 实例,也就是说我们的busiSysInfoService对象不存在,导致注入失败,然后抛出了Error creating bean with name 'dataInteractionController这个异常,既然是busiSysInfoService这个对象的问题,那么我们就首先来分析,busiSysInfoService对象如何添加到容器,所以我们要看一下
1、busiSysInfoServiceImpl 是否加上@Service注解
2、busiSysInfoMapper 是否加上@Repository注解
如果以上都没有问题,考虑BusiSysInfo实体中各字段类型是否错误,如果都不存在,请一定考虑以下问题
沒有符合的bean可用
这种情况在DemoApplication中添加@MapperScan(basePackages = {“com.example.demo.mapper”}),我的问题是这样解决的。
希望对大家有用
来源地址:https://blog.csdn.net/weixin_46870864/article/details/128132222
--结束END--
本文标题: 解决异常Error creating bean with name ‘xxxxxController‘: Unsatisfied dependency expressed through field
本文链接: https://lsjlt.com/news/384389.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-04-01
2024-04-03
2024-04-03
2024-01-21
2024-01-21
2024-01-21
2024-01-21
2023-12-23
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0