Injection of autowired dependencies failed,beans.factory.annotation.Autowired(required=true)

首先,检查对应的MVC各层的配置文件,发现applicationContext-*.xml都没有问题,

然后检查了web.xml,发现扫描包的配置没有问题,

但是,最后发现applicationContext-*.xml的xml字体有红色标记,虽然没有报错,关键是eclipse校验单词拼写造成,如果出在配置文件中,一般会影响到程序的正常执行。

解决办法:

解决方法:在eclipse下的Window--Preference输入spell,然后把第一个复选框“Enable spell checking“给去掉就可以了。

Spring 启动报错 Injection of autowired dependencies failed 求大神帮忙 !

10-11

[code=java][framework] 2013-10-11 18:45:02,944 - org.springframework.web.context.ContextLoader -3 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failedrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'areaController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.xinyatu.oa.service.AreaService com.xinyatu.oa.controller.AreaController.areaService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'areaServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.xinyatu.oa.dao.BaseDao com.xinyatu.oa.service.AreaServiceImpl.baseDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [com/xinyatu/oa/model/TAssetAssetorder.hbm.xml] cannot be opened because it does not existrn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)rn at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4172)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4671)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)rn at org.apache.catalina.core.StandardService.start(StandardService.java:525)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:585)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)rnCaused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.xinyatu.oa.service.AreaService com.xinyatu.oa.controller.AreaController.areaService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'areaServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.xinyatu.oa.dao.BaseDao com.xinyatu.oa.service.AreaServiceImpl.baseDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [com/xinyatu/oa/model/TAssetAssetorder.hbm.xml] cannot be opened because it does not existrn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)rn ... 37 morernCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'areaServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.xinyatu.oa.dao.BaseDao com.xinyatu.oa.service.AreaServiceImpl.baseDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [com/xinyatu/oa/model/TAssetAssetorder.hbm.xml] cannot be opened because it does not existrn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)rn at rn[/code]rnrn实在找不到 错误在哪 求大神帮忙 谢谢了!

SSH注解式Injection of autowired dependencies failed求教

05-06

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ukReceivableMakeupService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.hope.dao.IGenericDao com.hope.service.impl.IGenericServiceImpl.iGenericDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.hope.dao.IGenericDao] is defined: expected single matching bean but found 2: [ukReceivableMakeupDao, ukReceivableMakeUpsDao]rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1055)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1259)rn at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1998)rn at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)rn at java.util.concurrent.FutureTask.run(FutureTask.java:262)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)rn at java.lang.Thread.run(Thread.java:745)rnCaused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.hope.dao.IGenericDao com.hope.service.impl.IGenericServiceImpl.iGenericDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.hope.dao.IGenericDao] is defined: expected single matching bean but found 2: [ukReceivableMakeupDao, ukReceivableMakeUpsDao]rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:507)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:283)rn ... 26 morernCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.hope.dao.IGenericDao] is defined: expected single matching bean but found 2: [ukReceivableMakeupDao, ukReceivableMakeUpsDao]rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:777)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:685)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)rn ... 28 morern五月 06, 2016 10:20:19 上午 org.apache.catalina.core.StandardContext startInternalrn严重: One or more listeners failed to start. Full details will be found in the appropriate container log filern五月 06, 2016 10:20:19 上午 org.apache.catalina.core.StandardContext startInternalrn严重: Context [/SSH_3] startup failed due to previous errorsrn五月 06, 2016 10:20:19 上午 org.apache.catalina.core.ApplicationContext logrn信息: Closing Spring root WebApplicationContextrn五月 06, 2016 10:20:19 上午 org.apache.catalina.startup.HostConfig deployDirectoryrn信息: Deployment of web application directory D:\apache-tomcat-7.0.68\webapps\SSH_3 has finished in 5,633 msrn五月 06, 2016 10:20:19 上午 org.apache.catalina.startup.HostConfig deployDirectoryrn信息: Deploying web application directory D:\apache-tomcat-7.0.68\webapps\weepalextjsrn五月 06, 2016 10:20:19 上午 org.apache.catalina.startup.HostConfig deployDirectoryrn信息: Deployment of web application directory D:\apache-tomcat-7.0.68\webapps\weepalextjs has finished in 47 msrn五月 06, 2016 10:20:19 上午 org.apache.coyote.AbstractProtocol startrn信息: Starting ProtocolHandler ["http-apr-8080"]rn五月 06, 2016 10:20:19 上午 org.apache.coyote.AbstractProtocol startrn信息: Starting ProtocolHandler ["ajp-apr-8009"]rn五月 06, 2016 10:20:19 上午 org.apache.catalina.startup.Catalina startrn信息: Server startup in 14677 msrn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试