Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDepe

Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name  xxx

spring bean创建失败

我的是ssm项目,项目已启动就报错,mapper接口和mapper的配置文件放在了两个文件夹下,导致创建失败

具体解决可以参考另一篇博客 地址
学习solr时,也出现类似错误,是在把solrServer交由spring容器管理时出现

sending contextinitialized event to listener instance of classorg.springframework.web.context.ContextLoaderListener

 org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'itemServiceImpl': Injection of autowireddependencies failed; nested exception isorg.springframework.beans.factory.BeanCreationException: Could not autowirefield: org.apache.solr.client.solrj.SolrServercom.taotao.search.service.impl.ItemServiceImpl.solrServer; nested exception isorg.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifyingbean of type [org.apache.solr.client.solrj.SolrServer] found for dependency:expected at least 1 bean which qualifies as autowire candidate for thisdependency. Dependency annotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}

solrServer 配置到 spring 容器中,启动出现这种情况,提示 itemServieImpl 中不能 autowired

itemServieImpl代码:



再次看报错,向前看是springcontext初始化出错,那么什么时候加载spring容器的呢?

自然,这得看web.xml

重点是这里加载spring容器只是将spring/下面的所有applicationContext-*.xml文件加载

但是我的solr是这样的

改成这样试试,启动成功!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值