Unsatisfied dependency expressed through constructor argument




Asked on April 08, 2013
Hi All,
I am running a spring program and getting below error. Help me.

Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employee' defined in class path resource [application-config.xml]: Unsatisfied dependency expressed through constructor argument with index 1 of type [int]: 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:1035)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)

Thanks



Replied on April 08, 2013
As error says that you are using constructor argument type to create bean and you are giving wrong type. check constructor argument type and accordingly inject the value in application-config.xml.


Write Answer










©2024 concretepage.com | Privacy Policy | Contact Us