Thursday, January 9, 2014

Spring Course V14: Setting List Properties

lets say you have this class

as you can see it takes List as a constructor argument,
in order to pass list as a constructor argument (or as property) you write

<bean id="basket" class="FruitBasket">
<constructor-arg value="John's basket"></constructor-arg>

NOTE: as you can see we use <list> to pass a list as argument, but actually we can use <set> as well, however when we use <set> spring will eliminate duplicate values (like orange in the example above. 

No comments:

Post a Comment