Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

Wiring lists and arrays in spring

I was reading folowing line and I did not understand clearly.

Wiring lists and arrays

 When using Hibernate with Spring,
you willl wire a LocalSessionFactoryBean into the container. The LocalSession
FactoryBean has a mappingResources property that takes a List of Strings containing
the names of Hibernate mapping files. Here’s a snippet of XML that we will
introduce to the bean wiring file when we get around to talking about Hibernate:
<bean id="sessionFactory" class=
"org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>/com/springinaction/training/model/Course.hbm.xml</value>
<value>/com/springinaction/training/model/Student.hbm.xml</value>
</list>
</property>

</bean>
Although the previous snippet wires a List of String values, you are not limited
to using only <value>s as entries in a <list>. You may use any element that is
valid when wiring a singular property, including <value>, <ref>, or even another
collection such as <list>. The only limitation is in what your beans expectations
are
 you can not wire in a List of Foos when your bean is expecting a List of Bars.

Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial