How to define a List bean in Spring?

I’m using Spring to define stages in my application. It’s configured that the necessary class (here called Configurator) is injected with the stages.
Now I need the List of Stages in another class, named LoginBean. The Configurator doesn’t offer access to his List of Stages.

I cannot change the class Configurator.

My Idea:
Define a new bean called Stages and inject it to Configurator and LoginBean.
My problem with this idea is that I don’t know how to transform this property:

<property ...>
  <list>
    <bean ... >...</bean>
    <bean ... >...</bean>
    <bean ... >...</bean>
  </list>
</property>

into a bean.

Something like this does not work:

<bean id="stages" class="java.util.ArrayList">

Can anybody help me with this?

13 Answers
13

Leave a Comment