Results 1 to 2 of 2

Thread: Constructor signature and spring-core

Hybrid View

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    Try:
    <constructor-arg index="0">

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 5
    Last Post: Aug 9th, 2008, 05:30 AM
  3. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  4. No one hires for Spring expertise
    By ctassoni in forum Meta
    Replies: 13
    Last Post: May 5th, 2005, 04:29 PM
  5. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •