Spring mvc 向bean定义动态添加bean引用列表

Spring mvc 向bean定义动态添加bean引用列表,spring-mvc,applicationcontext,spring-bean,Spring Mvc,Applicationcontext,Spring Bean,我试图通过使用ApplicationContextAware接口在ApplicationContext中动态注册一些SpringBean。我正在使用BeanDefinitionBuilder构建bean定义,并将它们注册到DefaultListableBeanFactory.registerBeanDefinition()。我现在尝试构建的bean在XML中看起来像这样: <bean id="compositeBean" class="SomeClass"> <property

我试图通过使用ApplicationContextAware接口在ApplicationContext中动态注册一些SpringBean。我正在使用BeanDefinitionBuilder构建bean定义,并将它们注册到DefaultListableBeanFactory.registerBeanDefinition()。我现在尝试构建的bean在XML中看起来像这样:

<bean id="compositeBean" class="SomeClass">
<property name="checks">
     <list>
         <ref bean="bean1"/>
         <ref bean="bean2"/>
         <ref bean="bean3"/>
     </list>
</property>
</bean>
我最后犯了错误

 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'compositeBean': Initialization of bean
 failed; nested exception is
 org.springframework.beans.ConversionNotSupportedException: Failed to
 convert property value of type
 'org.springframework.beans.factory.config.BeanDefinition[]' to
 required type 'SomeClass[]' for property 'checks'; nested exception is
 java.lang.IllegalStateException: Cannot convert value of type
 [org.springframework.beans.factory.support.GenericBeanDefinition] to
 required type [SomeClass] for property 'checks[0]': no matching
 editors or conversion strategy found

如何以编程方式将bean引用列表添加到我的compositeBean?

请查看org.springframework.beans.factory.support.ManagedList

这就是
用来编译列表的内容。创建一个ManagedList作为变量“checks”,并将该对象设置为属性值

 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'compositeBean': Initialization of bean
 failed; nested exception is
 org.springframework.beans.ConversionNotSupportedException: Failed to
 convert property value of type
 'org.springframework.beans.factory.config.BeanDefinition[]' to
 required type 'SomeClass[]' for property 'checks'; nested exception is
 java.lang.IllegalStateException: Cannot convert value of type
 [org.springframework.beans.factory.support.GenericBeanDefinition] to
 required type [SomeClass] for property 'checks[0]': no matching
 editors or conversion strategy found