exception sending context initialized event to listener instance of class [org.springframework.web.context.contextloaderlistener] org.springframework.beans.factory.beancreationexception: error creating bean with name 'citycontroller': injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.beancreationexception: could not autowire field: private com.formstest.service.icityservice com.formstest.controller.citycontroller.icityservice; nested exception is org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [com.formstest.service.icityservice] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)} at org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor.postprocesspropertyvalues(autowiredannotationbeanpostprocessor.java:334) at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1202) at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:537) at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:476) at org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:303) at org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) at org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:299) at org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194) at org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:762) at org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:757) at org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:480) at org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:403) at org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:306) at org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:106) at org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4745) at org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5207) at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1419) at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1409) at java.util.concurrent.futuretask.run(futuretask.java:266) at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1149) at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:624) at java.lang.thread.run(thread.java:748) caused by: org.springframework.beans.factory.beancreationexception: could not autowire field: private com.formstest.service.icityservice com.formstest.controller.citycontroller.icityservice; nested exception is org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [com.formstest.service.icityservice] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)} at org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:561) at org.springframework.beans.factory.annotation.injectionmetadata.inject(injectionmetadata.java:88) at org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor.postprocesspropertyvalues(autowiredannotationbeanpostprocessor.java:331) ... 22 more caused by: org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [com.formstest.service.icityservice] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)} at org.springframework.beans.factory.support.defaultlistablebeanfactory.raisenosuchbeandefinitionexception(defaultlistablebeanfactory.java:1308) at org.springframework.beans.factory.support.defaultlistablebeanfactory.doresolvedependency(defaultlistablebeanfactory.java:1054) at org.springframework.beans.factory.support.defaultlistablebeanfactory.resolvedependency(defaultlistablebeanfactory.java:949) at org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:533) ... 24 more
使用tomcat服务器启动项目的时候,报了error creating bean with name 'citycontroller': injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.beancreationexception: could not autowire field: private com.formstest.service.icityservice com.formstest.controller.citycontroller.icityservice;
nested exception is org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [com.formstest.service.icityservice] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)}
这样的问题之前也出现过,主要是因为在编写service实现类的时候忘记添加:implements 进行接口实现,从而导致无法创建bean:citycontroller
如对本文有疑问, 点击进行留言回复!!
NullPointerException: Attempt to invoke virtual method ‘android.content.res.XmlResourceParser androi
关于启动appium-desktop,报错:Cannot extract apk info using apkanalyzer. Falling back to aapt. Original ....
Gradle 发布共享库——如何通过Gradle发布Android依赖库(aar)到 jitpack 公共仓库
Gradle 发布共享库——如何通过Gradle发布java依赖库(jar)到 jitpack 公共仓库(—)
网友评论