Announcement Announcement Module
Collapse
No announcement yet.
Constructor signature and spring-core Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Constructor signature and spring-core

    Hi,

    I got a class XmlDAo that implement IPersonDAO ok ?

    Code:
    public class XmlDao implements IPersonDAO
    I got another class that recevied a IPersonDAO as a an argument, at build

    Code:
    public PhoneBookImpl(IPersonDAO dao)
    So i wrote this in my config.xml file :

    Code:
    <bean id="phoneBook" class="com.ao.springframework.webflow.samples.phonebook.doa.PhoneBookImpl">
    			<constructor-arg><ref bean="XmlDao"/></constructor-arg>
    		</bean>
    But at runtime, i have this error :

    Error creating bean with name 'phoneBook' defined in class path resource
    [org/springframework/webflow/samples/phonebook/deploy/service-layer.xml]:
    1 constructor arguments specified but no matching constructor found in bean 'phoneBook' (hint: specify index arguments for simple parameters to avoid type ambiguities)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:576)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:312)
    XmlDao implements IPersonDAO so it should work, shouldn't it ?

    Did I miss something, somewhere ?

  • #2
    Try:
    <constructor-arg index="0">

    Comment

    Working...
    X