org.springframework.beans.factory.NoSuchBeanDefinitionException

Struts Problem Report

Struts has detected an unhandled exception:

Messages:
  1. No qualifying bean of type [org.jbond.cms.service.CategoryService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, lookup=, authenticationType=CONTAINER)}
  2. Error creating bean with name 'userAction': Injection of resource dependencies failed; nested exception isorg.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.jbond.cms.service.CategoryService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, lookup=, authenticationType=CONTAINER)}
  3. Unable to instantiate Action, userAction, defined for 'user_login' in namespace '/'Error creating bean with name 'userAction': Injection of resource dependencies failed; nested exception isorg.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.jbond.cms.service.CategoryService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, lookup=, authenticationType=CONTAINER)}
File: org/springframework/beans/factory/support/DefaultListableBeanFactory.java
Line number: 1,373

Stacktraces

Unable to instantiate Action, userAction, defined for 'user_login' in namespace '/'Error creating bean with name 'userAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.jbond.cms.service.CategoryService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, lookup=, authenticationType=CONTAINER)}
    com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:316)
    com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:397)
 
    
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.jbond.cms.service.CategoryService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, lookup=, authenticationType=CONTAINER)}
    org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:311)
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1048)
    com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:151)
    com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:171)
    com.opensymphony.xwork2.factory.DefaultActionFactory.buildAction(DefaultActionFactory.java:22)
    com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:141)
   
    
   

解决方法:

很容易看出异常

service服务层,漏写@Service、@Transactional注解了

你可能感兴趣的:(javaweb,s2sh)