Question

I have below bean. I am using spring 3.x.

public class SomeClass<T extends OtherClass<K>, K> {

    List<T> listOfValues = new ArrayList<T>();

//some logic

}

How can i inject list of values into listOfValues through spring configuration file?

Thanks!

Was it helpful?

Solution

Use a list constant:

<bean id="SomeClassImpl" class="SomeClass" >
  <property name="listOfValues" >
    <util:list>
      <util:ref bean="bean1" />
      <util:ref bean="bean2" />
      ...
    </util:list>
  </property>
</bean>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top