I am testing my spring application, now what i want to do is define an arraylist to be used in my application.
i am trying this way but i am having errors:
what i want to do is like this (in java code terminology)Code:<bean id="testList" class="java.util.ArrayList"> <list> <value>Test</value> <ref bean="testViewBean"/> </list> </bean>
now testList will be used a parameter for one of my business class.Code:ArrayList testList = new ArrayList(); bean1 = new MyBean(); bean2 = new MyBean(); bean3 = new MyBean(); testList.add(bean1); testList.add(bean2); testList.add(bean3);
i am asking this because in my test i need to submit an ArrayList of MyBean() as parameter for one of my business class.
maybe someone can show me the proper way to do this in xml.Code:public void testSimpleCheck() { ArrayList testList = (ArrayList)this.applicationContext.getBean("testList"); for(int i=0;i<testList.size();i++){ MyBean bean = (MyBean) testList.get(i); ........... } }
thanks a lot guys.


Reply With Quote