Streamline XML namespace support towards unversioned schemas

This commit also removes support code for outdated options which were only available in older schema versions.

Issue: SPR-13499
This commit is contained in:
Juergen Hoeller
2016-07-05 20:50:00 +02:00
parent 12d373659a
commit bc2c22d51e
217 changed files with 413 additions and 41094 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.TypedStringValue;
@@ -32,8 +33,6 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.tests.beans.CollectingReaderEventListener;
import org.w3c.dom.Element;
import static org.junit.Assert.*;
/**
@@ -65,7 +64,6 @@ public class EventPublicationTests {
DocumentDefaultsDefinition defaults = (DocumentDefaultsDefinition) defaultsList.get(0);
assertEquals("true", defaults.getLazyInit());
assertEquals("constructor", defaults.getAutowire());
assertEquals("objects", defaults.getDependencyCheck());
assertEquals("myInit", defaults.getInitMethod());
assertEquals("myDestroy", defaults.getDestroyMethod());
assertEquals("true", defaults.getMerge());

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans default-lazy-init="true" default-autowire="constructor" default-dependency-check="objects"
default-init-method="myInit" default-destroy-method="myDestroy" default-merge="true">
<beans default-lazy-init="true" default-autowire="constructor" default-merge="true"
default-init-method="myInit" default-destroy-method="myDestroy">
<import resource="beanEventsImported.xml"/>

View File

@@ -8,7 +8,7 @@
<property name="age"><value>30</value></property>
<property name="spouse">
<!-- Could use id and href -->
<ref local="david"/>
<ref bean="david"/>
</property>
</bean>
@@ -29,8 +29,8 @@
<property name="friends">
<description>List of Rod's friends</description>
<list>
<ref local="jenny"/>
<ref local="david"/>
<ref bean="jenny"/>
<ref bean="david"/>
</list>
</property>
</bean>
@@ -39,7 +39,7 @@
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="spouse">
<ref local="david"/>
<ref bean="david"/>
</property>
</bean>
@@ -54,8 +54,8 @@
<property name="age"><value>32</value></property>
<property name="friends">
<list>
<ref local="pJenny"/>
<ref local="pDavid"/>
<ref bean="pJenny"/>
<ref bean="pDavid"/>
</list>
</property>
</bean>
@@ -69,7 +69,7 @@
<property name="friends">
<list>
<description>My List</description>
<ref local="david"/>
<ref bean="david"/>
</list>
</property>
</bean>
@@ -77,12 +77,12 @@
<bean id="jumble" class="org.springframework.beans.factory.xml.MixedCollectionBean">
<property name="jumble">
<list>
<ref local="david"/>
<ref bean="david"/>
<value>literal</value>
<ref local="jenny"/>
<idref local="rod"/>
<ref bean="jenny"/>
<idref bean="rod"/>
<array>
<ref local="david"/>
<ref bean="david"/>
<value>literal2</value>
</array>
</list>
@@ -92,9 +92,9 @@
<bean id="jumble2" class="org.springframework.beans.factory.xml.MixedCollectionBean" lazy-init="true">
<property name="jumble">
<list>
<ref local="david"/>
<ref bean="david"/>
<value>literal</value>
<ref local="jenny"/>
<ref bean="jenny"/>
<idref bean="rod"/>
<idref bean="rod2"/>
</list>
@@ -106,7 +106,7 @@
</bean>
<bean id="verbose2" class="org.springframework.tests.sample.beans.TestBean">
<property name="name"><idref local="verbose"/></property>
<property name="name"><idref bean="verbose"/></property>
</bean>
<bean id="verbose3" class="org.springframework.tests.sample.beans.TestBean">
@@ -140,7 +140,7 @@
<key>
<ref bean="jennyKey"/>
</key>
<ref local="jenny"/>
<ref bean="jenny"/>
</entry>
<entry>
<key>
@@ -192,16 +192,16 @@
<key><null/></key>
<value>bar</value>
</entry>
<entry key="jenny"><ref local="jenny"/></entry>
<entry key="jenny"><ref bean="jenny"/></entry>
<entry key="list">
<list>
<value>zero</value>
<map>
<entry key="fo"><value>bar</value></entry>
<entry key="jen"><ref local="jenny"/></entry>
<entry key="jen"><ref bean="jenny"/></entry>
</map>
<list>
<ref local="jenny"/>
<ref bean="jenny"/>
<value>ba</value>
</list>
<null/>
@@ -210,7 +210,7 @@
<entry key="map">
<map>
<entry key="foo"><value>bar</value></entry>
<entry key="jenny"><ref local="jenny"/></entry>
<entry key="jenny"><ref bean="jenny"/></entry>
</map>
</entry>
</map>
@@ -228,7 +228,7 @@
<property name="set">
<set>
<value>bar</value>
<ref local="jenny"/>
<ref bean="jenny"/>
<null/>
</set>
</property>
@@ -238,7 +238,7 @@
<property name="concurrentSet">
<set>
<value>bar</value>
<ref local="jenny"/>
<ref bean="jenny"/>
<null/>
</set>
</property>
@@ -283,7 +283,7 @@
<property name="objectArray">
<list>
<value>one</value>
<ref local="jenny"/>
<ref bean="jenny"/>
</list>
</property>
</bean>

View File

@@ -23,7 +23,7 @@
<bean id="testBeanOnly" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance">
<constructor-arg><ref local="juergen"/></constructor-arg>
<constructor-arg><ref bean="juergen"/></constructor-arg>
</bean>
<bean id="null" class="org.springframework.beans.factory.xml.FactoryMethods"
@@ -36,7 +36,7 @@
<bean id="full" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance">
<constructor-arg index="0"><ref local="juergen"/></constructor-arg>
<constructor-arg index="0"><ref bean="juergen"/></constructor-arg>
<constructor-arg index="1"><value>27</value></constructor-arg>
<constructor-arg index="2"><value>gotcha</value></constructor-arg>
</bean>
@@ -44,21 +44,21 @@
<bean id="fullWithNull" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance" lazy-init="true">
<constructor-arg index="2" type="java.lang.Integer"><null/></constructor-arg>
<constructor-arg index="0"><ref local="juergen"/></constructor-arg>
<constructor-arg index="0"><ref bean="juergen"/></constructor-arg>
<constructor-arg index="1"><value>27</value></constructor-arg>
</bean>
<bean id="fullWithGenericNull" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance" lazy-init="true">
<constructor-arg type="java.lang.Integer"><null/></constructor-arg>
<constructor-arg><ref local="juergen"/></constructor-arg>
<constructor-arg><ref bean="juergen"/></constructor-arg>
<constructor-arg type="int"><value>27</value></constructor-arg>
</bean>
<bean id="fullWithNamedNull" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance" lazy-init="true">
<constructor-arg name="something"><null/></constructor-arg>
<constructor-arg name="tb"><ref local="juergen"/></constructor-arg>
<constructor-arg name="tb"><ref bean="juergen"/></constructor-arg>
<constructor-arg name="num"><value>27</value></constructor-arg>
</bean>
@@ -80,25 +80,25 @@
<bean id="testBeanOnlyPrototype" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance" scope="prototype">
<constructor-arg><ref local="juergen"/></constructor-arg>
<constructor-arg><ref bean="juergen"/></constructor-arg>
<property name="stringValue"><value>testBeanOnlyPrototypeDISetterString</value></property>
</bean>
<bean id="invalidPrototype" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="nonExisting" scope="prototype">
<constructor-arg><ref local="juergen"/></constructor-arg>
<constructor-arg><ref bean="juergen"/></constructor-arg>
</bean>
<bean id="fullPrototype" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance" scope="prototype">
<constructor-arg type="int"><value>27</value></constructor-arg>
<constructor-arg><value>gotcha</value></constructor-arg>
<constructor-arg><ref local="juergen"/></constructor-arg>
<constructor-arg><ref bean="juergen"/></constructor-arg>
</bean>
<bean id="noMatchPrototype" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance" scope="prototype">
<constructor-arg index="0"><ref local="juergen"/></constructor-arg>
<constructor-arg index="0"><ref bean="juergen"/></constructor-arg>
<constructor-arg index="1"><value>27</value></constructor-arg>
<constructor-arg index="2"><value>gotcha</value></constructor-arg>
<constructor-arg index="3"><value>bogus</value></constructor-arg>

View File

@@ -55,7 +55,7 @@
<bean id="kerry" class="org.springframework.tests.sample.beans.TestBean">
<property name="name"><value>Ker<!-- a comment -->ry</value></property>
<property name="age"><value>34</value></property>
<property name="spouse"><ref local="rod"/></property>
<property name="spouse"><ref bean="rod"/></property>
<property name="touchy"><value></value></property>
</bean>
@@ -68,7 +68,7 @@
<bean id="typeMismatch" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
<property name="name"><value>typeMismatch</value></property>
<property name="age"><value>34x</value></property>
<property name="spouse"><ref local="rod"/></property>
<property name="spouse"><ref bean="rod"/></property>
</bean>
<!-- Test of lifecycle callbacks -->
@@ -96,20 +96,20 @@
repeated references to the same FactoryBean -->
<bean id="factoryReferencer" class="org.springframework.beans.factory.xml.DummyReferencer">
<property name="testBean1"><ref bean="singletonFactory"/></property>
<property name="testBean2"><ref local="singletonFactory"/></property>
<property name="testBean2"><ref bean="singletonFactory"/></property>
<property name="dummyFactory"><ref bean="&amp;singletonFactory"/></property>
</bean>
<bean id="factoryReferencerWithConstructor" class="org.springframework.beans.factory.xml.DummyReferencer">
<constructor-arg><ref bean="&amp;singletonFactory"/></constructor-arg>
<property name="testBean1"><ref bean="singletonFactory"/></property>
<property name="testBean2"><ref local="singletonFactory"/></property>
<property name="testBean2"><ref bean="singletonFactory"/></property>
</bean>
<!-- Check that the circular reference resolution mechanism doesn't break
prototype instantiation -->
<bean id="prototypeReferencer" class="org.springframework.beans.factory.xml.DummyReferencer" scope="prototype">
<property name="testBean1"><ref local="kathy"/></property>
<property name="testBean1"><ref bean="kathy"/></property>
<property name="testBean2"><ref bean="kathy"/></property>
</bean>