Respect <description> within <entry> per beans XSD
Prior to this change, a parsing exception would be thrown if a <description> element was placed within a <map><entry/></map> element. The beans XSD has always permitted this arrangement, but BeanDefinitionParserDelegate did not respect it. The latter now simply ignores any <description> element, rather than failing. Issue: SPR-8563
This commit is contained in:
@@ -1255,7 +1255,10 @@ public class BeanDefinitionParserDelegate {
|
||||
}
|
||||
else {
|
||||
// Child element is what we're looking for.
|
||||
if (valueEle != null) {
|
||||
if (nodeNameEquals(candidateEle, DESCRIPTION_ELEMENT)) {
|
||||
// the element is a <description> -> ignore it
|
||||
}
|
||||
else if (valueEle != null) {
|
||||
error("<entry> element must not contain more than one value sub-element", entryEle);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -155,6 +155,18 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- The <description> element below caused parsing exception prior to resolution of SPR-8563 -->
|
||||
<bean id="mapWithDescriptionInEntry" class="org.springframework.beans.factory.xml.HasMap">
|
||||
<property name="map">
|
||||
<map>
|
||||
<entry key="e1">
|
||||
<description>A map entry with a description</description>
|
||||
<value>v1</value>
|
||||
</entry>
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="fooKey" class="java.lang.String">
|
||||
<constructor-arg value="foo"/>
|
||||
</bean>
|
||||
|
||||
Reference in New Issue
Block a user