I'd like to do something like
<bean id="xxx" class="yyy"开发者_运维知识库>
<property name="list">
<list>
<ref bean="bean1" />
<ref bean="bean2" />
</list>
</property>
</bean>
The beans "bean1" and "bean2" are two different implementations of an interface I. However, they belong to different classes. Does anyone know how I can do this? I have no problem constructing a list of Strings and a list of Integers. Why can't I construct a list of beans?
Thanks,
ktmThe beans "bean1" and "bean2" are two different implementations of an interface I. However, they belong to different classes. Does anyone know how I can do this?
It should work. Try it.
(There should be no runtime type problem here because the runtime type of the list is the raw type of the implementation class used.)
I have no problem constructing a list of Strings and a list of Integers. Why can't I construct a list of beans?
I think you are assuming that it won't work without trying it.
精彩评论