Results 1 to 4 of 4

Thread: setting property of one bean using property of other bean

  1. #1
    Join Date
    Aug 2005
    Posts
    4

    Default setting property of one bean using property of other bean

    Hi,

    I am new to Spring Framework, and I need help implementing the following scenario using Spring core Framework.
    I have 2 classes Class A and Class B. Class A has an ArrayList of Class B and Class B contains the properties of class A.

    I would really appreciate if someone could help me on this. Also please point me to the resources where I can find the solution for the same.

    Thanks & Regards
    Harish

  2. #2
    Join Date
    Mar 2005
    Location
    montreal, Canada
    Posts
    52

    Default

    Hi,

    I guess you will have a lot more chances of getting answers if you post the same question in the following forum :
    http://forum.springframework.org/viewforum.php?f=4

  3. #3
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    Take a look at chapter 3 of the spring reference documention for details on how to define something like that in a Spring application context (http://static.springframework.org/sp...nce/beans.html).

    You would end up with something like this:
    Code:
    <bean id="a" class="A">
       <property name="bList">
          <list>
             <ref bean="b0"/>
             <ref bean="b1"/>
          </list>
       </property>
    </bean>
    
    <bean id="b0" class="B">
       <property name="prop" value="foo"/>
    </bean>
    <bean id="b1" class="B">
       <property name="prop" value="bar"/>
    </bean>
    Erwin

  4. #4
    Join Date
    Aug 2005
    Posts
    4

    Default

    Hi,

    Thanks a lot everyone for your help.

    Regards
    Harish

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
  •