码迷,mamicode.com
首页 > 其他好文 > 详细

error creating bean with name "" Autowiring of fields failed

时间:2014-09-01 17:47:33      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   os   io   java   strong   

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 {

。。。。。。。。

}

error creating bean with name "" Autowiring of fields failed

标签:des   style   blog   http   color   os   io   java   strong   

原文地址:http://blog.csdn.net/huaweitman/article/details/38982145

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!