2016-01-04 70 views
0

加載我的Spring應用程序時發生此錯誤。我已經檢查了相應bean(PerformanceSchedulePoster)的所有構造函數參數。這裏我使用了五個構造函數參數,所有五個構造函數參數都是不同的類型。任何人都可以幫助我解決依賴性問題。我重視以下日誌:通過帶有索引3的構造函數參數表達的不明確的依賴關係類型不明確的構造函數參數類型

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.enttek.unified.rest.server.handler.AssembledMethodHandlerFactory#111bcbb' defined in class path resource [spring/imports/backOfficeWebServices-spring.xml]: Cannot resolve reference to bean 'PerformanceSchedulePoster' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'PerformanceSchedulePoster' defined in class path resource 

[spring/imports/backOfficeWebServices-spring.xml]: Unsatisfied dependency expressed through constructor argument with index 3 of type [com.enttek.framework.util.plugin.ServiceFactory]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments? 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) 
     at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:630) 
     at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270) 
     ... 138 more 
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'PerformanceSchedulePoster' defined in class path resource [spring/imports/backOfficeWebServices-spring.xml]: Unsatisfied dependency expressed through constructor argument with index 3 of type [com.enttek.framework.util.plugin.ServiceFactory]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments? 
     at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:716) 
     at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192) 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) 
     ... 146 more 
+0

請正確地格式化你的代碼;) –

+1

後如何初始化豆 – StanislavL

+1

和bean構造:) –

回答

-1

每當你得到這種類型的錯誤..請參閱在服務層倉庫和字段名稱中使用的字段名稱相同與實體字段名。

例如, 我在實體聲明字段名稱爲userFullInfo 和我使用和存儲庫定義爲userInfo 和服務層古稱repository.findByUserInfo_Id(); 那麼你得到這些類型的錯誤。

因此,您只需檢查實體,存儲庫和服務中使用的參數類型。

相關問題