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是这样的

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

猜你喜欢

转载自blog.csdn.net/qq_36922927/article/details/79834481