हम वर्तमान में वसंत ढांचे का उपयोग कर रहे हैं और निम्न XML का उपयोग कर रहे: -ConversionNotSupportedException जब वस्तुओं की एक सूची के लिए RuntimeBeanRefrence का उपयोग कर
<bean id="A" class="com.foo.baar.A" >
<property name="attributes">
<set value-type="com.foo.bar.B">
<ref bean="X" />
<ref bean="Y" />
</set>
</property>
</bean>
<bean id="X" class="com.foo.bar.X" />
<bean id="Y" class="com.foo.bar.Y" />
जहां दसवीं कक्षा और कक्षा वाई वर्ग बी का विस्तार
वर्ग एक के रूप में सेटर है इस प्रकार है: -
public void setAttributes(List<B> attributes) {
this.attributes = attributes;
}
अब, मैं ऊपर एक्सएमएल खत्म करने के लिए है और मैं निम्नलिखित के रूप में प्रोग्राम के सेम की स्थापना कर रहा हूँ: -
012,List<Object> beanRefrences = new ArrayList<Object>();
for(String attribute : attributes) {
Object beanReference = new RuntimeBeanReference(attribute);
beanRefrences.add(beanReference);
}
mutablePropertyValues.add(propertyName, beanRefrences);
ऊपर कोड के साथ, मैं त्रुटि निम्न हो रही है: -
nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.util.List' for property 'attributes';
nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.beans.factory.config.RuntimeBeanReference] to required type [com.foo.bar.B] for property 'attributes[0]': no matching editors or conversion strategy found
किसी को भी मुझे कैसे इसे सही ढंग से काम करने के लिए पर संकेत दे सकते हैं?
लगता है: आप एक
ManagedList
उपयोग करने के लिए की जरूरत है। – zeroflagL@DexterMorgan, क्या आप इसे काम करते हैं? – whiskeysierra