Results 1 to 2 of 2

Thread: ref vs idref attributes in spring bean declaration

  1. #1

    Default ref vs idref attributes in spring bean declaration



    ref vs idref attributes in spring bean declaration.
    Can someone tell me the difference and which one has to be used when ?

    <bean id="b1" class="" />

    <bean id="" class="">
    <property name="b1" ref="b1" />
    </bean>

    vs

    <bean id="" class="">
    <property name="b1" idref="b1" />
    </bean>

    I do have a reference to the following thread, but it doesn't say when to use one over the other.
    http://forum.springsource.org/showthread.php?t=74355

  2. #2
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    1. 'idref' is not a valid spring <bean> element attribute. You get corresponding error if you attempt to start the container with such a configuration;
    2. The reference is quite cleat about <idref> element usage - 3.3.2.1.1. The idref element;

Tags for this Thread

Posting Permissions

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