My requirement is put multiple instances of a bean (scope=prototype) into an ArrayList.
Is there any automatic way to achieve it.
Currently I have written a helper class to return the bean instance and also add this new instances to member ArrayList as shown below:
Code:public List<Employee> empList = new ArrayList<Employee>(); public Employee getEmployee() { ApplicationContext empContext = new ClassPathXmlApplicationContext( "employee-module.xml"); Employee emp = (Employee) empContext.getBean("empBean"); empList.add(emp); return emp; }


Reply With Quote
