2012-08-11 42 views
0

無法在春季使用合併的屬性與列表標籤

<bean id="parentTriangle" class="org.kiran.spring.Triangle" abstract="true"> 
<property name="type"> 
<list> 
    <value>equilateral</value> 
    <value>scalene</value> 
</list> 
</property> 
</bean> 

<bean id="triangle" class="org.kiran.spring.Triangle" parent="parentTriangle" > 
<property name="type"> 
    <list merge="true"> 
     <value>isosceles</value> 
    </list> 
</property> 
</bean> 

它拋出一個錯誤 我是否需要添加任何東西的頭,使其工作?

+2

它拋出什麼錯誤到底是什麼? – Xaerxess 2012-08-11 21:25:27

+0

請添加上下文,這是您的類和異常的代碼。好點Xaerxess,+1 – 2012-08-11 21:46:32

+0

所有reqd進口r作出..它拋出一個org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException – Kiran 2012-08-11 22:40:29

回答

1

你的彈簧配置就好,你缺少一個方案配置。 驗證您的Spring配置有以下標題:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd ">