Results 1 to 3 of 3

Thread: Child bean definition has neither 'id' nor 'name' error

  1. #1
    Join Date
    Aug 2004
    Posts
    123

    Default Child bean definition has neither 'id' nor 'name' error

    I want to use Spring to populate a list which will be used in a JSP. I don't want to store references to the individual beans (with id, etc), and fortunately I don't have to, the following works just fine, with merely the class being specified, and then the properties for each bean being assigned.

    <property name="optionList">
    <list>
    <bean class="testing.web.ListViewSelectOption">
    <property name="name">
    <value>id</value>
    </property>
    <property name="textLength">
    <value>5</value>
    </property>
    etc...

    Where it comes unstuck is that I want to be able to specify a parent bean, containing some default properties so all the properties don't have to be specified each time. Thus I modify the above so I have:

    <bean id="basicOption" class="sailingnetworks.web.ListViewSelectOption"/>
    [default properties set]

    and for each bean:

    <bean parent="baseOption">

    Now, though, when it is inheriting from a parent, I get the following error:
    org.springframework.beans.factory.BeanDefinitionSt oreException: Error registering bean with name '' defined in file [/opt/projects/testing/listViewApplicationContext.xml]: Child bean definition has neither 'id' nor 'name'

    So it only objects to not having an id or name when it is inheriting from a parent bean, which seems odd. I don't know whether this is a bug, or something I'm doing. It's with Spring 1.1.1.

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    You should try 1.1.3. If this was indeed happening in 1.1.1, it doesn't happen in 1.1.3. There's no problem having an inner bean in 1.1.3 which derives from a parent, and doesn't specify any name or id.
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3
    Join Date
    Aug 2004
    Posts
    123

    Default

    Quote Originally Posted by Colin Sampaleanu
    You should try 1.1.3. If this was indeed happening in 1.1.1, it doesn't happen in 1.1.3. There's no problem having an inner bean in 1.1.3 which derives from a parent, and doesn't specify any name or id.
    You're absolutely right, 1.1.3 fixes this. Wonderful, thanks!

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 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
  •