Spring 启动时报错 Injection of resource dependencies failed

木心__ 木心__ 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
spring项目,单独启动时没有问题,当把这个项目打包后,在其他项目中引用后,在启动时报错
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(ClassA)' defined in class path resource []: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method '(ClassA)' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nameA': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'CLassB' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}

在中
@Bean
public ClassC nameA() {
return new ClassC ();
}

public class ClassC implements WebSocketHandler{
@Resource
CLassB xxx;
}

xml中配置
<bean id="nameB" class="ClassD" />

ClassD implements CLassB
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
木心__
Web 开发 81,108 成员 341,721 内容