How can you reference a bean from another bean in Spring?

How can you reference a bean from another bean in Spring?

We use the <property> element to set the properties that reference other beans. 

The <ref> sub-element of <property> lets us do this:

  <bean id=\"foo\"
     class=\"com.Foo\">
    <property name=\"bar\">
      <ref bean=\"bar\"/>
    </property>
  </bean>

By:Jalees
Date:2031-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher