Announcement Announcement Module
Collapse
No announcement yet.
Referencing local lists Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Referencing local lists

    Similar to the way that a local bean can be referenced from within the same XML file, i.e.

    <ref local="XYZ"/>

    where bean XYZ has been declared as

    <bean id="XYZ"..../>

    is there a way to reference other local attributes, i.e. lists.

    So if I declare a list,

    <list id="test">.... </list>

    and then want to set this list as a property in my bean

    <bean id="XYZ...>
    <property name="listofNames">
    <ref local..?
    </property>

    is there a way that i can reference the list that I declared outside of the bean definition?

  • #2
    You can declare a bean of a list type and reference that as property. Example:

    <bean id="myList" class="java.util.ArrayList">
    <constructor-arg index="0">
    <list>
    ... your values go here ...
    </list>
    </constructor-arg>
    </bean>

    <bean id="myBean" class=...>
    <property name="myListProperty">
    <ref local="myList"/>
    </property>
    </bean>

    Of course you may use Set, Map etc. as well.

    Regards,
    Andreas

    Comment

    Working...
    X