3

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!

user755806
  • 6,565
  • 27
  • 106
  • 153
  • This answer comes from the source of Spring: http://stackoverflow.com/questions/19808914/spring-dynamic-dependency-injection – Eugene Jan 09 '14 at 11:06

1 Answers1

0

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>
Peter Bratton
  • 6,302
  • 6
  • 39
  • 61