zoukankan      html  css  js  c++  java
  • service类上要有标注,否则会报下面的错。缺少唯一的一个serivce bean。

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    Unable to instantiate Action, orgMgrAction,  defined for 'orgMgr' in namespace '/customer'Error creating bean with name 'orgMgrAction': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.crm.service.personnel.PersonnelService org.crm.action.customer.orgMgrAction.personnelService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.crm.service.personnel.PersonnelService] is defined: Unsatisfied dependency of type [class org.crm.service.personnel.PersonnelService]: expected at least 1 matching bean
    	com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:306)
    	com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387)
    	com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
    	org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
    

    root cause

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orgMgrAction': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.crm.service.personnel.PersonnelService org.crm.action.customer.orgMgrAction.personnelService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.crm.service.personnel.PersonnelService] is defined: Unsatisfied dependency of type [class org.crm.service.personnel.PersonnelService]: expected at least 1 matching bean
    	org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	java.security.AccessController.doPrivileged(Native Method)
    

    org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.crm.service.personnel.PersonnelService org.crm.action.customer.orgMgrAction.personnelService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.crm.service.personnel.PersonnelService] is defined: Unsatisfied dependency of type [class org.crm.service.personnel.PersonnelService]: expected at least 1 matching bean
    org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
    org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)

    org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.crm.service.personnel.PersonnelService] is defined: Unsatisfied dependency of type [class org.crm.service.personnel.PersonnelService]: expected at least 1 matching bean
    org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
    org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor

    解决办法: 在service类的前面加上标注。

    @Service("personnelService")
    @Transactional
    public class PersonnelService {

    。。。。。。。。

    }

  • 相关阅读:
    hbase 得到一行的数据详情
    文件上传
    es 启动用户
    es 分片丢失
    es 调整查询窗口
    hbase 字段值开头查询
    maven 项目linux运行可执行jar
    hbase count 扫表查询
    hbase 查询空串空字段
    sql常用手法(二)
  • 原文地址:https://www.cnblogs.com/guanghuiqq/p/2643820.html
Copyright © 2011-2022 走看看