pojo - How to define a property of type List<E> in a Spring Bean? -
i work hybris , in beans.xml file can define pojos used in projects.
i want know how can define pojo in spring property of type list e should type define in beans.xml.
for example, want define pojo this:
public class mypojo{ private string someproperty; public string getsomeproperty(){ return someproperty; } public void setsomeproperty(string someproperty){ this.someproperty = someproperty; } }
and pojo contain list of mypojo:
public class mypojolistholder{ private list<mypojo> mypojolist; public list<mypojo> getmypojolist(){ return mypojolist; } public void setmypojolist(string mypojolist){ this.mypojolist= mypojolist; } }
mypojo defined in beans.xml follows:
<bean class="my.package.mypojo"> <property name="someproperty" type="java.lang.string"></property> </bean>
i can define mypojolistholder this:
<bean class="my.package.mypojolistholder"> <property name="mypojolist" type="java.util.list"></property> </bean>
but creates class mypojolist defined list object, i'd defined list.
how can achieve this?
you can do, example, like:
<property name="genders" type="java.util.list<com.your.package.data.genderdata>"/>
in example, end with
<bean class="my.package.mypojolistholder"> <property name="mypojolist" type="java.util.list<my.package.mypojo>"></property> </bean>
Comments
Post a Comment