org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘XXXX‘
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name ‘topicsServiceImpl’ defined in file
[E:\user\java3learn.metadata.plugins\org.eclipse.wst.server.core\tmp0\webapps\SSHVote\WEB-INF\classes\com\xh\vote\service\impl\TopicsServiceImpl.class]:
Initialization of bean failed; nested exception is
java.lang.NoClassDefFoundError:
org/springframework/core/NativeDetector at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)
~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE] at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE] at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE] at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
目前我碰到的错误
此异常,为:注入 bean 失败异常。
说白了,出现这个异常,就是找不到对应的 bean !能够导致 bean 注入失败的原因包括以下几种但不限于这几种:
对应的 bean 没有添加注解;
对应的 bean 添加注解错误,例如将 Spring 的@Service错选成 dubbo 的;
还有就是web.xml配置错误
还有就是pom.xml导入的包有问题
选择错误的自动注入方法等。
而我的错误就是pom.xml导包有问题导致的。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)