woshimeihuo
魅惑青花瓷
采纳率100%
2015-05-24 14:32 阅读 9.3k
已采纳

spring中提示BeanCreationException

20
  1. 2015-05-24 22:16:48,030 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed
  2. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aomRapsController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.thinkgem.jeesite.modules.rap.service.AomRapsService com.thinkgem.jeesite.modules.rap.web.AomRapsController.somRapsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aomRapsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.thinkgem.jeesite.common.persistence.CrudDao com.thinkgem.jeesite.common.service.CrudService.dao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.thinkgem.jeesite.common.persistence.CrudDao] 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)}
  3. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:301)
  4. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1186)
  5. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
  6. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
  7. at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
  8. at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
  9. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
  10. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
  11. at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706)
  12. at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)
  13. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
  14. at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658)
  15. at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:624)
  16. at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:672)
  17. at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:543)
  18. at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484)
  19. at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
  20. at javax.servlet.GenericServlet.init(GenericServlet.java:160)
  21. at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
  22. at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
  23. at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:865)
  24. at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
  25. at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
  26. at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
  27. at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
  28. at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
  29. at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
  30. at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  31. at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
  32. at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
  33. at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
  34. at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
  35. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  36. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  37. at java.lang.Thread.run(Thread.java:744)
  38. Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.thinkgem.jeesite.modules.rap.service.AomRapsService com.thinkgem.jeesite.modules.rap.web.AomRapsController.somRapsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aomRapsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.thinkgem.jeesite.common.persistence.CrudDao com.thinkgem.jeesite.common.service.CrudService.dao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.thinkgem.jeesite.common.persistence.CrudDao] 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)}
  39. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:522)
  40. at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
  41. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:298)
  42. ... 34 more
  43. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aomRapsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.thinkgem.jeesite.common.persistence.CrudDao com.thinkgem.jeesite.common.service.CrudService.dao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.thinkgem.jeesite.common.persistence.CrudDao] 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)}
  44. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:301)
  45. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1186)
  46. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
  47. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
  48. at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
  49. at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
  50. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
  51. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
  52. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:271)
  53. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
  54. at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1021)
  55. at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:964)
  56. at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:862)
  57. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:494)
  58. ... 36 more图片说明图片说明
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    stvnshi 灵魂舞 2015-05-25 03:45

    @Autowired 会自动寻找你定义的这个class的类名的首字母小写的spring bean的定义。所以这个取决于你用的这个AomRapsService是怎么定义的。如果它也是通过在AomRapsService上面加上@Service的方式来定义,那spring会自动生成一个bean id="aomRapsService"的spring bean。但是如果这个class的定义是自己在spring xml里面写了一个bean id="AomRapsService"的spring bean,这种autowired的方式会失败。解决方法是使用@Resource(name=“AomRapsService”)

    点赞 评论 复制链接分享
  • caozhy 从今以后生命中的每一秒都属于我爱的人 2015-05-24 14:42

    这种错误多半是配置文件的问题,没有找到jar包

    点赞 1 评论 复制链接分享

相关推荐