moved XmlBeanFactoryTests and attendant XML from .testsuite -> .context

This commit is contained in:
Chris Beams
2008-12-20 08:19:32 +00:00
parent d083432478
commit 3da373eeaf
49 changed files with 44 additions and 70 deletions

View File

@@ -0,0 +1,76 @@
/*
* Copyright 2002-2005 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.xml;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
/**
* Simple bean used to test dependency checking.
*
* Note: would be defined within {@link XmlBeanFactoryTestTypes}, but must be a public type
* in order to satisfy test dependencies.
*
* @author Rod Johnson
* @author Chris Beams
* @since 04.09.2003
*/
public final class DependenciesBean implements BeanFactoryAware {
private int age;
private String name;
private TestBean spouse;
private BeanFactory beanFactory;
public void setAge(int age) {
this.age = age;
}
public int getAge() {
return age;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setSpouse(TestBean spouse) {
this.spouse = spouse;
}
public TestBean getSpouse() {
return spouse;
}
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
public BeanFactory getBeanFactory() {
return beanFactory;
}
}

View File

@@ -0,0 +1,732 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.xml;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.sql.DataSource;
import org.springframework.beans.BeansException;
import org.springframework.beans.ITestBean;
import org.springframework.beans.IndexedTestBean;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.DummyFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.support.MethodReplacer;
/**
* Types used by {@link XmlBeanFactoryTests} and its attendant XML config files.
*
* @author Chris Beams
*/
final class XmlBeanFactoryTestTypes { }
/**
* Simple bean used to check constructor dependency checking.
*
* @author Juergen Hoeller
* @since 09.11.2003
*/
@SuppressWarnings("serial")
class ConstructorDependenciesBean implements Serializable {
private int age;
private String name;
private TestBean spouse1;
private TestBean spouse2;
private IndexedTestBean other;
public ConstructorDependenciesBean(int age) {
this.age = age;
}
public ConstructorDependenciesBean(String name) {
this.name = name;
}
public ConstructorDependenciesBean(TestBean spouse1) {
this.spouse1 = spouse1;
}
public ConstructorDependenciesBean(TestBean spouse1, TestBean spouse2) {
this.spouse1 = spouse1;
this.spouse2 = spouse2;
}
public ConstructorDependenciesBean(TestBean spouse1, TestBean spouse2, int age) {
this.spouse1 = spouse1;
this.spouse2 = spouse2;
this.age = age;
}
public ConstructorDependenciesBean(TestBean spouse1, TestBean spouse2, IndexedTestBean other) {
this.spouse1 = spouse1;
this.spouse2 = spouse2;
this.other = other;
}
public int getAge() {
return age;
}
public String getName() {
return name;
}
public TestBean getSpouse1() {
return spouse1;
}
public TestBean getSpouse2() {
return spouse2;
}
public IndexedTestBean getOther() {
return other;
}
public void setAge(int age) {
this.age = age;
}
public void setName(String name) {
this.name = name;
}
}
/**
* Bean testing the ability to use both lookup method overrides
* and constructor injection.
* There is also a property ("setterString") to be set via
* Setter Injection.
*
* @author Rod Johnson
*/
abstract class ConstructorInjectedOverrides {
private ITestBean tb;
private String setterString;
public ConstructorInjectedOverrides(ITestBean tb) {
this.tb = tb;
}
public ITestBean getTestBean() {
return this.tb;
}
protected abstract FactoryMethods createFactoryMethods();
/**
* @return Returns the setterString.
*/
public String getSetterString() {
return setterString;
}
/**
* @param setterString The setterString to set.
*/
public void setSetterString(String setterString) {
this.setterString = setterString;
}
}
/**
* Simple bean used to check constructor dependency checking.
*
* @author Juergen Hoeller
* @since 09.11.2003
*/
@SuppressWarnings("serial")
class DerivedConstructorDependenciesBean extends ConstructorDependenciesBean {
boolean initialized;
boolean destroyed;
DerivedConstructorDependenciesBean(TestBean spouse1, TestBean spouse2, IndexedTestBean other) {
super(spouse1, spouse2, other);
}
private DerivedConstructorDependenciesBean(TestBean spouse1, Object spouse2, IndexedTestBean other) {
super(spouse1, null, other);
}
protected DerivedConstructorDependenciesBean(TestBean spouse1, TestBean spouse2, IndexedTestBean other, int age, int otherAge) {
super(spouse1, spouse2, other);
}
public DerivedConstructorDependenciesBean(TestBean spouse1, TestBean spouse2, IndexedTestBean other, int age, String name) {
super(spouse1, spouse2, other);
setAge(age);
setName(name);
}
private void init() {
this.initialized = true;
}
private void destroy() {
this.destroyed = true;
}
}
/**
*
* @author Rod Johnson
*/
interface DummyBo {
void something();
}
/**
*
* @author Rod Johnson
*/
class DummyBoImpl implements DummyBo {
DummyDao dao;
public DummyBoImpl(DummyDao dao) {
this.dao = dao;
}
public void something() {
}
}
/**
* @author Rod Johnson
*/
class DummyDao {
DataSource ds;
public DummyDao(DataSource ds) {
this.ds = ds;
}
}
/**
* @author Juergen Hoeller
* @since 21.07.2003
*/
class DummyReferencer {
private TestBean testBean1;
private TestBean testBean2;
private DummyFactory dummyFactory;
public DummyReferencer() {
}
public DummyReferencer(DummyFactory dummyFactory) {
this.dummyFactory = dummyFactory;
}
public void setDummyFactory(DummyFactory dummyFactory) {
this.dummyFactory = dummyFactory;
}
public DummyFactory getDummyFactory() {
return dummyFactory;
}
public void setTestBean1(TestBean testBean1) {
this.testBean1 = testBean1;
}
public TestBean getTestBean1() {
return testBean1;
}
public void setTestBean2(TestBean testBean2) {
this.testBean2 = testBean2;
}
public TestBean getTestBean2() {
return testBean2;
}
}
/**
* Test class for Spring's ability to create objects using static
* factory methods, rather than constructors.
*
* @author Rod Johnson
* @author Juergen Hoeller
*/
class FactoryMethods {
public static FactoryMethods nullInstance() {
return null;
}
public static FactoryMethods defaultInstance() {
TestBean tb = new TestBean();
tb.setName("defaultInstance");
return new FactoryMethods(tb, "default", 0);
}
/**
* Note that overloaded methods are supported.
*/
public static FactoryMethods newInstance(TestBean tb) {
return new FactoryMethods(tb, "default", 0);
}
protected static FactoryMethods newInstance(TestBean tb, int num, String name) {
if (name == null) {
throw new IllegalStateException("Should never be called with null value");
}
return new FactoryMethods(tb, name, num);
}
static FactoryMethods newInstance(TestBean tb, int num, Integer something) {
if (something != null) {
throw new IllegalStateException("Should never be called with non-null value");
}
return new FactoryMethods(tb, null, num);
}
private static List<?> listInstance() {
return Collections.EMPTY_LIST;
}
private int num = 0;
private String name = "default";
private TestBean tb;
private String stringValue;
/**
* Constructor is private: not for use outside this class,
* even by IoC container.
*/
private FactoryMethods(TestBean tb, String name, int num) {
this.tb = tb;
this.name = name;
this.num = num;
}
public void setStringValue(String stringValue) {
this.stringValue = stringValue;
}
public String getStringValue() {
return this.stringValue;
}
public TestBean getTestBean() {
return this.tb;
}
protected TestBean protectedGetTestBean() {
return this.tb;
}
private TestBean privateGetTestBean() {
return this.tb;
}
public int getNum() {
return num;
}
public String getName() {
return name;
}
/**
* Set via Setter Injection once instance is created.
*/
public void setName(String name) {
this.name = name;
}
}
/**
* Fixed method replacer for String return types
* @author Rod Johnson
*/
class FixedMethodReplacer implements MethodReplacer {
public static final String VALUE = "fixedMethodReplacer";
public Object reimplement(Object obj, Method method, Object[] args) throws Throwable {
return VALUE;
}
}
/**
* @author Chris Beams
*/
class MapAndSet {
private Object obj;
public MapAndSet(Map<?, ?> map) {
this.obj = map;
}
public MapAndSet(Set<?> set) {
this.obj = set;
}
public Object getObject() {
return obj;
}
}
/**
* @author Rod Johnson
*/
class MethodReplaceCandidate {
public String replaceMe(String echo) {
return echo;
}
}
/**
* Bean that exposes a simple property that can be set
* to a mix of references and individual values.
*
* @author Rod Johnson
* @since 27.05.2003
*/
class MixedCollectionBean {
private Collection<?> jumble;
public void setJumble(Collection<?> jumble) {
this.jumble = jumble;
}
public Collection<?> getJumble() {
return jumble;
}
}
/**
* @author Juergen Hoeller
*/
interface OverrideInterface {
TestBean getPrototypeDependency();
TestBean getPrototypeDependency(Object someParam);
}
/**
* @author Rod Johnson
* @author Juergen Hoeller
*/
abstract class OverrideOneMethod extends MethodReplaceCandidate implements OverrideInterface {
protected abstract TestBean protectedOverrideSingleton();
public TestBean getPrototypeDependency(Object someParam) {
return new TestBean();
}
public TestBean invokesOverridenMethodOnSelf() {
return getPrototypeDependency();
}
public String echo(String echo) {
return echo;
}
/**
* Overloaded form of replaceMe.
*/
public String replaceMe() {
return "replaceMe";
}
/**
* Another overloaded form of replaceMe, not getting replaced.
* Must not cause errors when the other replaceMe methods get replaced.
*/
public String replaceMe(int someParam) {
return "replaceMe:" + someParam;
}
}
/**
* Subclass of OverrideOneMethod, to check that overriding is
* supported for inherited methods.
*
* @author Rod Johnson
*/
abstract class OverrideOneMethodSubclass extends OverrideOneMethod {
protected void doSomething(String arg) {
// This implementation does nothing!
// It's not overloaded
}
}
/**
* Simple test of BeanFactory initialization and lifecycle callbacks.
*
* @author Rod Johnson
* @author Juergen Hoeller
*/
class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean {
protected boolean initMethodDeclared = false;
protected String beanName;
protected BeanFactory owningFactory;
protected boolean postProcessedBeforeInit;
protected boolean inited;
protected boolean initedViaDeclaredInitMethod;
protected boolean postProcessedAfterInit;
protected boolean destroyed;
public void setInitMethodDeclared(boolean initMethodDeclared) {
this.initMethodDeclared = initMethodDeclared;
}
public boolean isInitMethodDeclared() {
return initMethodDeclared;
}
public void setBeanName(String name) {
this.beanName = name;
}
public String getBeanName() {
return beanName;
}
public void setBeanFactory(BeanFactory beanFactory) {
this.owningFactory = beanFactory;
}
public void postProcessBeforeInit() {
if (this.inited || this.initedViaDeclaredInitMethod) {
throw new RuntimeException("Factory called postProcessBeforeInit after afterPropertiesSet");
}
if (this.postProcessedBeforeInit) {
throw new RuntimeException("Factory called postProcessBeforeInit twice");
}
this.postProcessedBeforeInit = true;
}
public void afterPropertiesSet() {
if (this.owningFactory == null) {
throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean");
}
if (!this.postProcessedBeforeInit) {
throw new RuntimeException("Factory didn't call postProcessBeforeInit before afterPropertiesSet on lifecycle bean");
}
if (this.initedViaDeclaredInitMethod) {
throw new RuntimeException("Factory initialized via declared init method before initializing via afterPropertiesSet");
}
if (this.inited) {
throw new RuntimeException("Factory called afterPropertiesSet twice");
}
this.inited = true;
}
public void declaredInitMethod() {
if (!this.inited) {
throw new RuntimeException("Factory didn't call afterPropertiesSet before declared init method");
}
if (this.initedViaDeclaredInitMethod) {
throw new RuntimeException("Factory called declared init method twice");
}
this.initedViaDeclaredInitMethod = true;
}
public void postProcessAfterInit() {
if (!this.inited) {
throw new RuntimeException("Factory called postProcessAfterInit before afterPropertiesSet");
}
if (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) {
throw new RuntimeException("Factory called postProcessAfterInit before calling declared init method");
}
if (this.postProcessedAfterInit) {
throw new RuntimeException("Factory called postProcessAfterInit twice");
}
this.postProcessedAfterInit = true;
}
/**
* Dummy business method that will fail unless the factory
* managed the bean's lifecycle correctly
*/
public void businessMethod() {
if (!this.inited || (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) ||
!this.postProcessedAfterInit) {
throw new RuntimeException("Factory didn't initialize lifecycle object correctly");
}
}
public void destroy() {
if (this.destroyed) {
throw new IllegalStateException("Already destroyed");
}
this.destroyed = true;
}
public boolean isDestroyed() {
return destroyed;
}
public static class PostProcessor implements BeanPostProcessor {
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
if (bean instanceof ProtectedLifecycleBean) {
((ProtectedLifecycleBean) bean).postProcessBeforeInit();
}
return bean;
}
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
if (bean instanceof ProtectedLifecycleBean) {
((ProtectedLifecycleBean) bean).postProcessAfterInit();
}
return bean;
}
}
}
/**
* @author Rod Johnson
*/
@SuppressWarnings("serial")
class ReverseMethodReplacer implements MethodReplacer, Serializable {
public Object reimplement(Object obj, Method method, Object[] args) throws Throwable {
String s = (String) args[0];
return new StringBuffer(s).reverse().toString();
}
}
/**
* @author Rod Johnson
*/
@SuppressWarnings("serial")
abstract class SerializableMethodReplacerCandidate extends MethodReplaceCandidate implements Serializable {
//public abstract Point getPoint();
}
/**
* @author Juergen Hoeller
* @since 23.10.2004
*/
class SingleSimpleTypeConstructorBean {
private boolean singleBoolean;
private boolean secondBoolean;
private String testString;
public SingleSimpleTypeConstructorBean(boolean singleBoolean) {
this.singleBoolean = singleBoolean;
}
public SingleSimpleTypeConstructorBean(String testString, boolean secondBoolean) {
this.testString = testString;
this.secondBoolean = secondBoolean;
}
public boolean isSingleBoolean() {
return singleBoolean;
}
public boolean isSecondBoolean() {
return secondBoolean;
}
public String getTestString() {
return testString;
}
}

View File

@@ -0,0 +1,64 @@
<?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>
<bean id="rod1" class="org.springframework.beans.factory.xml.DependenciesBean"
autowire="byType" dependency-check="objects">
<!-- Should pick up spouse automatically -->
</bean>
<bean id="rod1a" class="org.springframework.beans.factory.xml.DependenciesBean"
autowire="autodetect" dependency-check="objects">
<!-- Should pick up spouse automatically -->
</bean>
<bean id="rod2" class="org.springframework.beans.factory.xml.DependenciesBean"
autowire="byName" dependency-check="objects">
<!-- Should pick up spouse automatically -->
</bean>
<bean id="rod2a" class="org.springframework.beans.factory.xml.DependenciesBean"
autowire="byName" dependency-check="objects">
<property name="spouse" ref="spouse"/>
</bean>
<bean id="rod3" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean"
autowire="constructor" dependency-check="objects">
<!-- Should pick up spouse automatically -->
</bean>
<bean id="rod3a" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean"
autowire="autodetect" dependency-check="objects">
<!-- Should pick up spouse automatically -->
</bean>
<bean id="rod4" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean"
scope="prototype" dependency-check="objects">
<!-- Should not pick up spouse automatically -->
</bean>
<bean id="rod5" class="org.springframework.beans.factory.xml.DependenciesBean"
scope="prototype" autowire="constructor">
<!-- Should pick up spouse automatically -->
</bean>
<bean id="other" class="org.springframework.beans.IndexedTestBean"/>
<bean id="parentAppCtx" class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<value>/org/springframework/beans/factory/xml/XmlBeanFactoryTests-collections.xml</value>
</constructor-arg>
</bean>
<bean id="childAppCtx" class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<list>
<value>/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorArg.xml</value>
<value>/org/springframework/beans/factory/xml/XmlBeanFactoryTests-initializers.xml</value>
</list>
</constructor-arg>
<constructor-arg><ref bean="parentAppCtx"/></constructor-arg>
</bean>
</beans>

View File

@@ -0,0 +1,51 @@
<?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>
<bean id="inheritsFromParentFactory" parent="inheritedTestBean">
<property name="name"><value>override</value></property>
<!-- age should inherit value of 1 from parent -->
</bean>
<bean id="inheritsWithDifferentClass" class="org.springframework.beans.DerivedTestBean"
parent="inheritedTestBean" init-method="initialize">
<property name="name"><value>override</value></property>
<!-- age should inherit value of 1 from parent -->
</bean>
<bean id="inheritsWithClass" class="org.springframework.beans.DerivedTestBean"
parent="inheritedTestBeanWithoutClass" init-method="initialize">
<property name="name"><value>override</value></property>
<!-- age should inherit value of 1 from parent -->
</bean>
<bean id="protoypeInheritsFromParentFactorySingleton" parent="inheritedTestBean" scope="prototype">
<property name="name"><value>prototypeOverridesInheritedSingleton</value></property>
<!-- age should inherit value of 1 from parent -->
</bean>
<bean id="prototypeInheritsFromParentFactoryPrototype" parent="inheritedTestBeanPrototype" scope="prototype">
<property name="name"><value>prototype-override</value></property>
<!-- age should inherit value of 2 from parent -->
</bean>
<bean id="singletonInheritsFromParentFactoryPrototype" parent="inheritedTestBeanPrototype" scope="singleton">
<property name="name"><value>prototype-override</value></property>
<!-- age should inherit value of 2 from parent -->
</bean>
<bean id="inheritedTestBean" parent="inheritedTestBean">
<property name="name"><value>overrideParentBean</value></property>
<!-- age should inherit value of 1 from parent -->
</bean>
<bean id="bogusParent" parent="bogus" scope="prototype"/>
<bean id="indexedTestBean" class="org.springframework.beans.IndexedTestBean">
<property name="array[0].name"><value>myname</value></property>
</bean>
<bean parent="inheritedTestBean"/>
</beans>

View File

@@ -0,0 +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>
<bean id="classNotFound" class="WhatALotOfRubbish"/>
</beans>

View File

@@ -0,0 +1,376 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="jenny" class="org.springframework.beans.TestBean">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="spouse">
<!-- Could use id and href -->
<ref local="david"/>
</property>
</bean>
<bean id="david" class="org.springframework.beans.TestBean">
<description>
Simple bean, without any collections.
</description>
<property name="name">
<description>The name of the user</description>
<value>David</value>
</property>
<property name="age"><value>27</value></property>
</bean>
<bean id="rod" class="org.springframework.beans.TestBean">
<property name="name"><value>Rod</value></property>
<property name="age"><value>32</value></property>
<property name="friends">
<description>List of Rod's friends</description>
<list>
<ref local="jenny"/>
<ref local="david"/>
</list>
</property>
</bean>
<bean id="pJenny" class="org.springframework.beans.TestBean" scope="prototype">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="spouse">
<!-- Could use id and href -->
<ref local="david"/>
</property>
</bean>
<bean id="pDavid" class="org.springframework.beans.TestBean" scope="prototype">
<property name="name"><value>David</value></property>
<property name="age"><value>27</value></property>
</bean>
<bean id="pRod" class="org.springframework.beans.TestBean" scope="prototype">
<property name="name"><value>Rod</value></property>
<property name="age"><value>32</value></property>
<property name="friends">
<list>
<ref local="pJenny"/>
<ref local="pDavid"/>
</list>
</property>
</bean>
<!--
Try setting a collection property to a single value
-->
<bean id="loner" class="org.springframework.beans.TestBean">
<property name="name"><value>loner</value></property>
<property name="age"><value>26</value></property>
<property name="friends">
<list>
<description>My List</description>
<ref local="david"/>
</list>
</property>
</bean>
<bean id="jumble" class="org.springframework.beans.factory.xml.MixedCollectionBean">
<property name="jumble">
<list>
<ref local="david"/>
<value>literal</value>
<ref local="jenny"/>
<idref local="rod"/>
</list>
</property>
</bean>
<bean id="jumble2" class="org.springframework.beans.factory.xml.MixedCollectionBean" lazy-init="true">
<property name="jumble">
<list>
<ref local="david"/>
<value>literal</value>
<ref local="jenny"/>
<idref bean="rod"/>
<idref bean="rod2"/>
</list>
</property>
</bean>
<bean id="verbose" class="org.springframework.beans.TestBean">
<property name="name"><value>verbose</value></property>
</bean>
<bean id="verbose2" class="org.springframework.beans.TestBean">
<property name="name"><idref local="verbose"/></property>
</bean>
<bean id="verbose3" class="org.springframework.beans.TestBean">
<property name="name"><idref bean="verbose"/></property>
</bean>
<bean id="emptyMap" class="org.springframework.beans.factory.HasMap">
<property name="map">
<map>
</map>
</property>
</bean>
<bean id="literalMap" class="org.springframework.beans.factory.HasMap">
<property name="map">
<map>
<entry key="foo" value="bar"/>
<entry key="fi" value="fum"/>
<entry key="fa"><null/></entry>
</map>
</property>
</bean>
<bean id="mixedMap" class="org.springframework.beans.factory.HasMap">
<property name="map">
<map>
<entry key-ref="fooKey">
<value type="java.lang.Integer">10</value>
</entry>
<entry>
<key>
<ref bean="jennyKey"/>
</key>
<ref local="jenny"/>
</entry>
<entry>
<key>
<bean class="java.lang.Integer">
<constructor-arg value="5"/>
</bean>
</key>
<idref bean="david"/>
</entry>
</map>
</property>
</bean>
<bean id="fooKey" class="java.lang.String">
<constructor-arg value="foo"/>
</bean>
<bean id="jennyKey" class="java.lang.String">
<constructor-arg value="jenny"/>
</bean>
<bean id="pMixedMap" class="org.springframework.beans.factory.HasMap" scope="prototype">
<property name="map">
<map>
<entry key="foo" value="bar"/>
<entry key="jenny" value-ref="pJenny"/>
</map>
</property>
</bean>
<bean id="mixedMapWithList" class="org.springframework.beans.factory.HasMap">
<property name="map">
<map>
<entry>
<key><null/></key>
<value>bar</value>
</entry>
<entry key="jenny"><ref local="jenny"/></entry>
<entry key="list">
<list>
<value>zero</value>
<map>
<entry key="fo"><value>bar</value></entry>
<entry key="jen"><ref local="jenny"/></entry>
</map>
<list>
<ref local="jenny"/>
<value>ba</value>
</list>
<null/>
</list>
</entry>
<entry key="map">
<map>
<entry key="foo"><value>bar</value></entry>
<entry key="jenny"><ref local="jenny"/></entry>
</map>
</entry>
</map>
</property>
</bean>
<bean id="emptySet" class="org.springframework.beans.factory.HasMap">
<property name="set">
<set>
</set>
</property>
</bean>
<bean id="set" class="org.springframework.beans.factory.HasMap">
<property name="set">
<set>
<value>bar</value>
<ref local="jenny"/>
<null/>
</set>
</property>
</bean>
<bean id="emptyProps" class="org.springframework.beans.factory.HasMap">
<property name="props">
<props>
</props>
</property>
</bean>
<bean id="props" class="org.springframework.beans.factory.HasMap">
<property name="props">
<props>
<prop key="foo">bar</prop>
<prop key="2">TWO</prop>
</props>
</property>
</bean>
<bean id="propsViaMap" class="org.springframework.beans.factory.HasMap">
<property name="props">
<map>
<entry key="foo" value="bar"/>
<entry key="2" value="TWO"/>
</map>
</property>
</bean>
<bean id="objectArray" class="org.springframework.beans.factory.HasMap">
<property name="objectArray">
<list>
<value>one</value>
<ref local="jenny"/>
</list>
</property>
</bean>
<bean id="classArray" class="org.springframework.beans.factory.HasMap">
<property name="classArray">
<list>
<value>java.lang.String</value>
<value>java.lang.Exception</value>
</list>
</property>
</bean>
<bean id="integerArray" class="org.springframework.beans.factory.HasMap">
<property name="integerArray">
<list>
<value>0</value>
<value>1</value>
<value>2</value>
</list>
</property>
</bean>
<bean id="listFactory" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list>
<value>bar</value>
<value>jenny</value>
</list>
</property>
<property name="targetListClass">
<value>java.util.LinkedList</value>
</property>
</bean>
<bean id="pListFactory" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list>
<value>bar</value>
<value>jenny</value>
</list>
</property>
<property name="targetListClass">
<value>java.util.LinkedList</value>
</property>
<property name="singleton">
<value>true</value>
</property>
</bean>
<bean id="setFactory" class="org.springframework.beans.factory.config.SetFactoryBean">
<property name="sourceSet">
<set>
<value>bar</value>
<value>jenny</value>
</set>
</property>
<property name="targetSetClass">
<value>java.util.TreeSet</value>
</property>
</bean>
<bean id="pSetFactory" class="org.springframework.beans.factory.config.SetFactoryBean">
<property name="sourceSet">
<set>
<value>bar</value>
<value>jenny</value>
</set>
</property>
<property name="targetSetClass">
<value>java.util.TreeSet</value>
</property>
<property name="singleton">
<value>true</value>
</property>
</bean>
<bean id="mapFactory" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="foo"><value>bar</value></entry>
<entry key="jen"><value>jenny</value></entry>
</map>
</property>
<property name="targetMapClass">
<value>java.util.TreeMap</value>
</property>
</bean>
<bean id="pMapFactory" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="foo"><value>bar</value></entry>
<entry key="jen"><value>jenny</value></entry>
</map>
</property>
<property name="targetMapClass">
<value>java.util.TreeMap</value>
</property>
<property name="singleton">
<value>true</value>
</property>
</bean>
<bean id="setAndMap" class="org.springframework.beans.factory.xml.MapAndSet">
<constructor-arg>
<map>
<description>My Map</description>
<entry key="key1" value="val1"/>
<entry key="key2" value="val2"/>
<entry key="key3" value="val3"/>
</map>
</constructor-arg>
</bean>
<bean id="enumSetFactory" class="org.springframework.beans.factory.config.SetFactoryBean">
<property name="sourceSet">
<set>
<description>My Set</description>
<value type="java.lang.String">ONE</value>
<value type="java.lang.String">TWO</value>
</set>
</property>
</bean>
</beans>

View File

@@ -0,0 +1,33 @@
<?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>
<bean id="proxy1" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces" value="java.io.Serializable"/>
<property name="targetName" value="target1"/>
</bean>
<bean id="target1" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean"
autowire="constructor"/>
<bean id="toBeFoundByType" class="org.springframework.beans.TestBean"/>
<bean id="proxy2" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces" value="org.springframework.beans.ITestBean"/>
<property name="targetName" value="target2"/>
</bean>
<bean id="target2" class="org.springframework.beans.factory.xml.DependenciesBean">
<property name="spouse">
<bean class="org.springframework.beans.TestBean">
<property name="someSet">
<set>
<ref local="proxy1"/>
</set>
</property>
</bean>
</property>
</bean>
</beans>

View File

@@ -0,0 +1,166 @@
<?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>
<bean id="rod1" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean">
<constructor-arg><ref bean="kerry2"/></constructor-arg>
</bean>
<bean id="rod2" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean">
<constructor-arg index="1" ref="kerry1"/>
<constructor-arg index="0" ref="kerry2"/>
<constructor-arg><ref bean="other"/></constructor-arg>
</bean>
<bean id="rod2Accessor" class="org.springframework.beans.TestBean" lazy-init="true">
<property name="friends">
<list>
<ref bean="rod2"/>
</list>
</property>
<property name="touchy" value="."/>
</bean>
<bean id="rod3" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean"
autowire="constructor">
<constructor-arg index="0"><ref bean="kerry2"/></constructor-arg>
<constructor-arg index="1"><ref bean="kerry2"/></constructor-arg>
</bean>
<bean id="rod4" class="org.springframework.beans.factory.xml.DerivedConstructorDependenciesBean"
autowire="constructor">
<constructor-arg index="0">
<description>wife</description>
<ref bean="kerry2"/>
</constructor-arg>
<constructor-arg><ref bean="kerry2"/></constructor-arg>
</bean>
<bean id="rod5" class="org.springframework.beans.factory.xml.DerivedConstructorDependenciesBean">
<constructor-arg index="1">
<description>wife</description>
<ref bean="kerry1"/>
</constructor-arg>
<constructor-arg index="3">
<description>
magic int value: 99 is the number of aliens who can dance on the tip of pin
</description>
<value>99</value>
</constructor-arg>
<constructor-arg><ref bean="other"/></constructor-arg>
<constructor-arg index="4"><value>myname</value></constructor-arg>
<constructor-arg index="0"><ref bean="kerry2"/></constructor-arg>
</bean>
<bean id="rod6" class="org.springframework.beans.factory.xml.DerivedConstructorDependenciesBean"
init-method="init" destroy-method="destroy">
<constructor-arg index="1"><ref bean="kerry1"/></constructor-arg>
<constructor-arg><ref bean="other"/></constructor-arg>
<constructor-arg index="0"><ref bean="kerry2"/></constructor-arg>
</bean>
<bean id="rod7" class="org.springframework.beans.factory.xml.DerivedConstructorDependenciesBean" scope="prototype">
<constructor-arg index="1"><ref bean="kerry1"/></constructor-arg>
<constructor-arg><ref bean="other"/></constructor-arg>
<constructor-arg><ref bean="other"/></constructor-arg>
<constructor-arg index="0"><ref bean="kerry2"/></constructor-arg>
</bean>
<bean id="rod8" class="org.springframework.beans.factory.xml.DerivedConstructorDependenciesBean" scope="prototype">
<constructor-arg index="2"><ref bean="other"/></constructor-arg>
<constructor-arg index="0"><ref bean="kerry2"/></constructor-arg>
</bean>
<bean id="rod9" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean" scope="prototype">
<constructor-arg type="int"><value>99</value></constructor-arg>
</bean>
<bean id="rod10" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean" scope="prototype">
<constructor-arg index="0" type="java.lang.String"><null/></constructor-arg>
</bean>
<bean id="rod11" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean" scope="prototype">
<constructor-arg index="0"><ref local="kerry2"/></constructor-arg>
</bean>
<bean id="rod12" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean">
<constructor-arg index="0"><ref bean="kerry1"/></constructor-arg>
</bean>
<bean id="rod13" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean">
<constructor-arg index="0"><ref bean="kerry1"/></constructor-arg>
<constructor-arg index="1"><ref bean="kerry2"/></constructor-arg>
</bean>
<bean id="rod14" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean">
<constructor-arg><ref bean="kerry1"/></constructor-arg>
<constructor-arg><ref bean="kerry2"/></constructor-arg>
</bean>
<bean id="rod15" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean">
<constructor-arg><ref bean="kerry2"/></constructor-arg>
<constructor-arg><ref bean="kerry1"/></constructor-arg>
</bean>
<bean id="rod16" class="org.springframework.beans.factory.xml.ConstructorDependenciesBean">
<constructor-arg><ref bean="kerry2"/></constructor-arg>
<constructor-arg><ref bean="kerry1"/></constructor-arg>
<constructor-arg><value>29</value></constructor-arg>
</bean>
<bean id="kerry1" class="org.springframework.beans.TestBean">
<property name="name">
<value>Kerry1</value>
</property>
<property name="age">
<value>33</value>
</property>
</bean>
<bean id="kerry2" class="org.springframework.beans.TestBean">
<property name="name">
<value>Kerry2</value>
</property>
<property name="age">
<value>32</value>
</property>
</bean>
<bean id="other" class="org.springframework.beans.IndexedTestBean"/>
<bean id="file" class="java.io.File">
<constructor-arg><value>/test</value></constructor-arg>
</bean>
<bean id="beanWithBoolean" class="org.springframework.beans.factory.xml.SingleSimpleTypeConstructorBean" scope="prototype">
<constructor-arg type="boolean" value="true"/>
</bean>
<bean id="beanWithBoolean2" class="org.springframework.beans.factory.xml.SingleSimpleTypeConstructorBean" scope="prototype">
<constructor-arg value="true"/>
</bean>
<bean id="beanWithBooleanAndString" class="org.springframework.beans.factory.xml.SingleSimpleTypeConstructorBean" scope="prototype">
<constructor-arg type="boolean"><value>true</value></constructor-arg>
<constructor-arg><value>A String</value></constructor-arg>
</bean>
<bean id="beanWithBooleanAndString2" class="org.springframework.beans.factory.xml.SingleSimpleTypeConstructorBean" scope="prototype">
<constructor-arg value="A String"/>
<constructor-arg value="true"/>
</bean>
<bean id="Boolean" class="java.lang.Boolean">
<constructor-arg value="false"/>
</bean>
<bean id="beanWithDoubleBoolean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DoubleBooleanConstructorBean" autowire="constructor" scope="prototype">
<constructor-arg type="java.lang.Boolean"><value>true</value></constructor-arg>
</bean>
<bean id="beanWithDoubleBooleanAndIndex" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DoubleBooleanConstructorBean" autowire="constructor" scope="prototype">
<constructor-arg index="1"><value>true</value></constructor-arg>
</bean>
</beans>

View File

@@ -0,0 +1,34 @@
<?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>
<bean id="constructorOverrides"
class="org.springframework.beans.factory.xml.ConstructorInjectedOverrides"
autowire="autodetect">
<!--
We combine a setter method with constructor
autowiring
-->
<property name="setterString"><value>from property element</value></property>
<lookup-method name="createFactoryMethods" bean="factoryMethods" />
</bean>
<bean id="jenny" class="org.springframework.beans.TestBean"
scope="singleton">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
</bean>
<bean id="factoryMethods"
class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance"
scope="prototype">
<constructor-arg index="0"><ref local="jenny"/></constructor-arg>
</bean>
</beans>

View File

@@ -0,0 +1,24 @@
<?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-autowire="byType" default-dependency-check="objects">
<bean id="rod1" class="org.springframework.beans.factory.xml.DependenciesBean">
<!-- Should pick up spouse automatically -->
</bean>
<bean id="rod2" class="org.springframework.beans.factory.xml.DependenciesBean">
<!-- Should pick up spouse automatically -->
</bean>
<bean id="rod3" class="org.springframework.beans.factory.xml.DependenciesBean" autowire="no">
<!-- Should not pick up spouse automatically -->
</bean>
<bean id="spouse" class="org.springframework.beans.TestBean" autowire="no" dependency-check="none">
<property name="name">
<value>Kerry</value>
</property>
</bean>
</beans>

View File

@@ -0,0 +1,20 @@
<?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">
<bean id="lazy-and-bad"
class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$BadInitializer"
init-method="init2"
/>
<bean id="init-and-ib"
class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$InitAndIB"
lazy-init="false"
init-method="customInit"
destroy-method="customDestroy"
/>
<bean id="prototype" class="org.springframework.beans.TestBean" scope="prototype"/>
</beans>

View File

@@ -0,0 +1,83 @@
<?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>
<!--
Not yet in use: illustration of possible approach
-->
<bean id="overrideOneMethod" class="org.springframework.beans.factory.xml.OverrideOneMethod">
<lookup-method name="getPrototypeDependency" bean="jenny"/>
<lookup-method name="protectedOverrideSingleton" bean="david"/>
<!-- Arbitrary method replacer -->
<replaced-method name="replaceMe" replacer="reverseReplacer">
<arg-type>String</arg-type>
</replaced-method>
<replaced-method name="replaceMe" replacer="fixedReplacer"/>
</bean>
<bean id="someParent" abstract="true">
<lookup-method name="getPrototypeDependency" bean="jenny"/>
<lookup-method name="protectedOverrideSingleton" bean="david"/>
<!--
This method is not overloaded, so we don't need to specify any arg types
-->
<replaced-method name="doSomething" replacer="doSomethingReplacer"/>
</bean>
<bean id="replaceVoidMethod" parent="someParent"
class="org.springframework.beans.factory.xml.OverrideOneMethodSubclass">
</bean>
<bean id="reverseReplacer"
class="org.springframework.beans.factory.xml.ReverseMethodReplacer"/>
<bean id="fixedReplacer"
class="org.springframework.beans.factory.xml.FixedMethodReplacer"/>
<bean id="doSomethingReplacer"
class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DoSomethingReplacer"/>
<bean id="serializableReplacer"
class="org.springframework.beans.factory.xml.SerializableMethodReplacerCandidate">
<!-- Arbitrary method replacer -->
<replaced-method name="replaceMe" replacer="reverseReplacer">
<arg-type>String</arg-type>
</replaced-method>
</bean>
<bean id="jenny" class="org.springframework.beans.TestBean"
scope="prototype">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="spouse">
<!-- Could use id and href -->
<ref local="david"/>
</property>
</bean>
<bean id="david" class="org.springframework.beans.TestBean"
scope="singleton">
<description>
Simple bean, without any collections.
</description>
<property name="name">
<description>The name of the user</description>
<value>David</value>
</property>
<property name="age"><value>27</value></property>
</bean>
</beans>

View File

@@ -0,0 +1,21 @@
<?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>
<bean id="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean">
<constructor-arg index="0"><ref local="preparingBean1"/></constructor-arg>
<constructor-arg index="1"><ref local="preparingBean2"/></constructor-arg>
</bean>
<bean id="preparingBean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="preparingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
<bean id="abstractFactoryBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true"/>
<bean id="lazyFactoryBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
lazy-init="true"/>
</beans>

View File

@@ -0,0 +1,16 @@
<?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>
<bean id="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean"
autowire="constructor"/>
<bean id="preparingBean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="preparingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
<bean id="abstractFactoryBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true"/>
</beans>

View File

@@ -0,0 +1,19 @@
<?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>
<bean id="holdingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$HoldingBean">
<property name="dependingBean">
<bean class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean">
<constructor-arg index="0"><ref local="preparingBean1"/></constructor-arg>
<constructor-arg index="1"><ref local="preparingBean2"/></constructor-arg>
</bean>
</property>
</bean>
<bean id="preparingBean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="preparingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
</beans>

View File

@@ -0,0 +1,13 @@
<?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>
<bean id="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean"
depends-on="preparingBean1, preparingBean2"/>
<bean id="preparingBean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="preparingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
</beans>

View File

@@ -0,0 +1,38 @@
<?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>
<bean id="holdingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$HoldingBean">
<property name="dependingBean">
<bean name="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean"
depends-on="preparingBean1,preparingBean2"/>
</property>
</bean>
<bean id="holdingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$HoldingBean">
<property name="dependingBean">
<bean name="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean"
depends-on="preparingBean1,preparingBean2"/>
</property>
</bean>
<bean id="holdingBean3" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$HoldingBean">
<property name="dependingBean">
<bean class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean"
depends-on="preparingBean1,preparingBean2"/>
</property>
</bean>
<bean id="holdingBean4" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$HoldingBean">
<property name="dependingBean">
<bean class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean"
depends-on="preparingBean1,preparingBean2"/>
</property>
</bean>
<bean id="preparingBean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="preparingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
</beans>

View File

@@ -0,0 +1,24 @@
<?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>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"/>
<bean id="dao" class="org.springframework.beans.factory.xml.DummyDao" autowire="constructor"/>
<bean id="boPrototype" autowire="constructor" class="org.springframework.beans.factory.xml.DummyBoImpl"
scope="prototype"/>
<bean id="prototypeTargetSource" class="org.springframework.aop.target.PrototypeTargetSource">
<property name="targetBeanName"><value>boPrototype</value></property>
</bean>
<bean id="prototypeBenchmark" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target"><ref local="prototypeTargetSource"/></property>
<property name="proxyInterfaces"><value>org.springframework.beans.factory.xml.DummyBo</value></property>
</bean>
<bean id="boSingleton" autowire="constructor" class="org.springframework.beans.factory.xml.DummyBoImpl"/>
</beans>

View File

@@ -0,0 +1,15 @@
<?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>
<bean id="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean">
<property name="bean1"><ref local="preparingBean1"/></property>
<property name="bean2"><ref local="preparingBean2"/></property>
</bean>
<bean id="preparingBean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="preparingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
</beans>

View File

@@ -0,0 +1,19 @@
<?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>
<bean id="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean"
autowire="byName"/>
<bean id="bean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="bean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
<bean id="abstractFactoryBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true"/>
<bean id="lazyFactoryBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
lazy-init="true"/>
</beans>

View File

@@ -0,0 +1,16 @@
<?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>
<bean id="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean"
autowire="byType"/>
<bean id="preparingBean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="preparingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
<bean id="abstractFactoryBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true"/>
</beans>

View File

@@ -0,0 +1,19 @@
<?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>
<bean id="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean">
<property name="inTheMiddleBean"><ref local="inTheMiddleBean"/></property>
</bean>
<bean id="inTheMiddleBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$InTheMiddleBean">
<property name="bean1"><ref local="preparingBean1"/></property>
<property name="bean2"><ref local="preparingBean2"/></property>
</bean>
<bean id="preparingBean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="preparingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
</beans>

View File

@@ -0,0 +1,19 @@
<?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>
<bean id="holdingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$HoldingBean">
<property name="dependingBean">
<bean id="dependingBean" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DependingBean">
<property name="bean1"><ref local="preparingBean1"/></property>
<property name="bean2"><ref local="preparingBean2"/></property>
</bean>
</property>
</bean>
<bean id="preparingBean1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean1"/>
<bean id="preparingBean2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$PreparingBean2"/>
</beans>

View File

@@ -0,0 +1,10 @@
<?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>
<bean id="singletonFactory" class="org.springframework.beans.factory.DummyFactory">
<property name="otherTestBean"><ref local="singletonFactory"/></property>
</bean>
</beans>

View File

@@ -0,0 +1,23 @@
<?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>
<bean id="init-method1" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$DoubleInitializer"
init-method="init">
<property name="num"><value>7</value></property>
</bean>
<bean id="init-method2" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$BadInitializer"
init-method="init2" scope="prototype"/>
<bean id="init-method3" class="org.springframework.beans.TestBean"
init-method="init" scope="prototype"/>
<bean id="init-and-ib" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$InitAndIB"
lazy-init="true" init-method="customInit" destroy-method="customDestroy"/>
<bean id="ib-same-init" class="org.springframework.beans.factory.xml.XmlBeanFactoryTests$InitAndIB"
lazy-init="true" init-method="afterPropertiesSet" destroy-method="destroy"/>
</beans>

View File

@@ -0,0 +1,20 @@
<?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>
<bean id="jenny" class="org.springframework.beans.TestBean">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="spouse">
<!-- Could use id and href -->
<ref local="david"/>
</property>
</bean>
<bogus></bogus>
</beans>

View File

@@ -0,0 +1,24 @@
<?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>
<bean id="constructorOverrides" class="org.springframework.beans.factory.xml.ConstructorInjectedOverrides"
autowire="autodetect">
<!-- No such lookup method -->
<lookup-method name="bogusMethod" bean="dummyBo" />
</bean>
<bean id="jenny" class="org.springframework.beans.TestBean" scope="singleton">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
</bean>
<bean id="factoryMethods" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="newInstance" scope="prototype">
<constructor-arg index="0"><ref local="jenny"/></constructor-arg>
</bean>
</beans>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<!-- just ensures that one can use <ref local=""/> to refer to the various <util:collections/> types -->
<util:map id="map"/>
<util:list id="list"/>
<util:set id="set"/>
<util:properties id="properties" location="org/springframework/beans/factory/xml/test.properties"/>
<bean id="bean" class="org.springframework.beans.TestBean">
<property name="someMap">
<map>
<entry key="map">
<ref local="map"/>
</entry>
</map>
</property>
<property name="someList">
<list>
<ref local="list"/>
</list>
</property>
<property name="someProperties">
<ref local="properties"/>
</property>
<property name="someSet">
<ref local="set"/>
</property>
</bean>
</beans>

View File

@@ -0,0 +1,17 @@
<?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>
<bean id="default" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="defaultInstance">
<!-- No constructor-arg elements -->
<property name="stringValue"><value>setterString</value></property>
</bean>
<bean id="defaultTestBean" factory-bean="default" factory-method="xgetTestBean"
init-method="haveBirthday" destroy-method="destroy"/>
</beans>

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="overrideOneMethod" class="org.springframework.beans.factory.xml.OverrideOneMethod">
<lookup-method name="getPrototypeDependency" bean="jenny"/>
<lookup-method name="protectedOverrideSingleton" bean="david"/>
</bean>
<!--
Test that overrides work on an inherited method
-->
<bean id="overrideInheritedMethod" class="org.springframework.beans.factory.xml.OverrideOneMethodSubclass">
<lookup-method name="getPrototypeDependency" bean="jenny"/>
<lookup-method name="protectedOverrideSingleton" bean="david"/>
</bean>
<!--
We can use this to test the construction cost of beans with method overrides
-->
<bean id="overrideOnPrototype" singleton="false"
class="org.springframework.beans.factory.xml.OverrideOneMethod">
<lookup-method name="getPrototypeDependency" bean="jenny"/>
<lookup-method name="protectedOverrideSingleton" bean="david"/>
</bean>
<!--
Effect of overrides is swapped
-->
<bean id="overrideOneMethodSwappedReturnValues"
class="org.springframework.beans.factory.xml.OverrideOneMethod">
<lookup-method name="getPrototypeDependency" bean="david"/>
<lookup-method name="protectedOverrideSingleton" bean="jenny"/>
</bean>
<bean id="jenny" class="org.springframework.beans.TestBean" singleton="false">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="spouse">
<ref local="david"/>
</property>
<property name="friends">
<bean class="org.springframework.beans.TestBean"/>
</property>
</bean>
<bean id="jennyParent" class="org.springframework.beans.TestBean">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="friends">
<bean class="org.springframework.beans.TestBean"/>
</property>
</bean>
<bean id="jennyChild" class="org.springframework.beans.TestBean" parent="jennyParent" singleton="false">
<property name="spouse">
<ref local="david"/>
</property>
</bean>
<bean id="david" class="org.springframework.beans.TestBean">
<description>
Simple bean, without any collections.
</description>
<property name="name">
<description>The name of the user</description>
<value>David</value>
</property>
<property name="age"><value>27</value></property>
</bean>
<bean id="magicDavid" class="org.springframework.beans.TestBean" autowire="byName"/>
<!-- this should be autowired as well! -->
<bean id="magicDavidDerived" parent="magicDavid" />
<bean id="spouse" class="org.springframework.beans.TestBean">
<property name="name" value="Linda"/>
</bean>
</beans>

View File

@@ -0,0 +1,23 @@
<?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>
<bean id="inheritedTestBean" class="org.springframework.beans.TestBean" abstract="true">
<property name="name"><value>parent</value></property>
<property name="age"><value>1</value></property>
</bean>
<bean id="inheritedTestBeanWithoutClass" abstract="true">
<property name="name"><value>parent</value></property>
<property name="age"><value>1</value></property>
</bean>
<bean id="inheritedTestBeanPrototype" class="org.springframework.beans.TestBean" scope="prototype">
<property name="name"><value>parent</value></property>
<property name="age"><value>2</value></property>
</bean>
<bean id="inheritedTestBeanSingleton" class="org.springframework.beans.TestBean"/>
</beans>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<import resource="XmlBeanFactoryTests-recursiveImport.xml"/>
</beans>

View File

@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?>
<bones>
<bean id="jenny" name="jenny" class="org.springframework.beans.TestBean">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="spouse"><ref local="david"/></property>
</bean>
<bean id="david" class="org.springframework.beans.TestBean">
<property name="name" value="David"/>
<property name="age" value="27"/>
<property name="spouse" ref="jenny"/>
</bean>
<bean id="jenks" class="org.springframework.beans.TestBean" scope="prototype">
<property name="name"><value>Andrew</value></property>
<property name="age"><value>36</value></property>
<property name="spouse"><ref local="jenny"/></property>
</bean>
<bean id="emma" class="org.springframework.beans.TestBean">
<property name="name" value="Emma"/>
<property name="age" value="31"/>
<property name="spouse" ref="jenks"/>
</bean>
<bean id="georgia" class="org.springframework.beans.TestBean">
<property name="name"><value>Georgia</value></property>
<property name="age"><value>33</value></property>
<property name="spouse"><ref local="jenks"/></property>
</bean>
<bean id="ego" class="org.springframework.beans.TestBean">
<property name="name" value="ego"/>
<property name="age" value="1"/>
<property name="spouse" ref="ego"/>
</bean>
<bean id="complexInnerEgo" class="org.springframework.beans.TestBean">
<property name="name" value="ego"/>
<property name="age" value="1"/>
<property name="spouse">
<bean class="org.springframework.beans.factory.DummyFactory">
<property name="otherTestBean" ref="complexInnerEgo"/>
</bean>
</property>
</bean>
<bean id="complexEgo" class="org.springframework.beans.TestBean">
<property name="name" value="ego"/>
<property name="age" value="1"/>
<property name="spouse" ref="egoBridge"/>
</bean>
<bean id="egoBridge" class="org.springframework.beans.factory.DummyFactory">
<property name="otherTestBean" ref="complexEgo"/>
</bean>
<bean id="ego1" class="org.springframework.beans.factory.DummyFactory">
<property name="otherTestBean" ref="ego2"/>
</bean>
<bean id="ego2" class="org.springframework.beans.factory.DummyFactory">
<property name="otherTestBean" ref="ego1"/>
</bean>
<bean id="ego3" class="org.springframework.beans.factory.DummyFactory">
<property name="otherTestBean">
<bean class="org.springframework.beans.factory.DummyFactory">
<property name="otherTestBean" ref="ego3"/>
</bean>
</property>
</bean>
<!-- This bean must not conflict with the actual inner beans named "innerBean" -->
<bean id="innerBean" class="org.springframework.beans.TestBean" destroy-method="destroy">
<constructor-arg><value>outer</value></constructor-arg>
<constructor-arg type="int"><value>0</value></constructor-arg>
</bean>
<bean id="hasInnerBeans" class="org.springframework.beans.TestBean">
<constructor-arg><value>hasInner</value></constructor-arg>
<constructor-arg index="1" type="int"><value>5</value></constructor-arg>
<property name="spouse">
<bean id="innerBean" class="org.springframework.beans.TestBean" destroy-method="destroy">
<constructor-arg><value>inner1</value></constructor-arg>
<constructor-arg type="int"><value>6</value></constructor-arg>
</bean>
</property>
<property name="friends">
<list>
<bean class="org.springframework.beans.DerivedTestBean">
<property name="name"><value>inner2</value></property>
<property name="age"><value>7</value></property>
</bean>
<bean id="innerBeanFactory" class="org.springframework.beans.factory.DummyFactory"/>
<bean id="innerBean" class="org.springframework.beans.TestBean" destroy-method="destroy">
<constructor-arg><value>inner5</value></constructor-arg>
<constructor-arg type="int"><value>6</value></constructor-arg>
</bean>
</list>
</property>
<property name="someMap">
<map>
<entry key="someKey">
<bean class="org.springframework.beans.TestBean" parent="jenny">
<constructor-arg><value>inner3</value></constructor-arg>
<constructor-arg type="int"><value>8</value></constructor-arg>
</bean>
</entry>
<entry key="someOtherKey">
<bean parent="jenny">
<property name="name"><value>inner4</value></property>
<property name="age"><value>9</value></property>
</bean>
</entry>
</map>
</property>
</bean>
<bean id="hasInnerBeansForConstructor" class="org.springframework.beans.TestBean">
<constructor-arg>
<bean id="innerBean" class="org.springframework.beans.TestBean" destroy-method="destroy">
<constructor-arg><value>inner1</value></constructor-arg>
<constructor-arg type="int"><value>6</value></constructor-arg>
</bean>
</constructor-arg>
</bean>
<bean id="hasInnerBeansWithoutDestroy" class="org.springframework.beans.TestBean">
<constructor-arg><value>hasInner</value></constructor-arg>
<constructor-arg index="1" type="int"><value>5</value></constructor-arg>
<property name="spouse">
<bean id="innerBean" class="org.springframework.beans.TestBean" scope="prototype">
<constructor-arg><value>inner1</value></constructor-arg>
<constructor-arg type="int"><value>6</value></constructor-arg>
</bean>
</property>
<property name="friends">
<list>
<bean class="org.springframework.beans.DerivedTestBean">
<property name="name"><value>inner2</value></property>
<property name="age"><value>7</value></property>
</bean>
<bean id="innerBeanFactory" class="org.springframework.beans.factory.DummyFactory"/>
<bean id="innerBean" class="org.springframework.beans.TestBean" scope="prototype">
<constructor-arg><value>inner5</value></constructor-arg>
<constructor-arg type="int"><value>6</value></constructor-arg>
</bean>
</list>
</property>
</bean>
<bean id="failsOnInnerBean" class="org.springframework.beans.TestBean">
<property name="someMap">
<map>
<entry key="someKey">
<bean class="org.springframework.beans.TestBean" parent="jenny">
<constructor-arg><value>inner3</value></constructor-arg>
<constructor-arg type="int"><value>8</value></constructor-arg>
<property name="touchy" value="."/>
</bean>
</entry>
<entry key="someOtherKey">
<bean parent="jenny">
<property name="name"><value>inner4</value></property>
<property name="age"><value>9</value></property>
</bean>
</entry>
</map>
</property>
</bean>
<bean id="failsOnInnerBeanForConstructor" class="org.springframework.beans.TestBean">
<constructor-arg>
<bean id="innerBean" class="org.springframework.beans.TestBean" destroy-method="destroy">
<constructor-arg><value>inner1</value></constructor-arg>
<constructor-arg type="int"><value>6</value></constructor-arg>
<property name="touchy" value="."/>
</bean>
</constructor-arg>
</bean>
</bones>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<import resource="XmlBeanFactoryTests-resourceImport.xml"/>
<bean id="resource2" class="org.springframework.beans.ResourceTestBean">
<constructor-arg index="0">
<value>classpath:org/springframework/beans/factory/xml/test.properties</value>
</constructor-arg>
<constructor-arg index="1">
<value>classpath:org/springframework/beans/factory/xml/test.properties</value>
</constructor-arg>
</bean>
</beans>

View File

@@ -0,0 +1,15 @@
<?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>
<bean id="resource1" class="org.springframework.beans.ResourceTestBean">
<property name="resource">
<value>classpath:org/springframework/beans/factory/xml/test.properties</value>
</property>
<property name="inputStream">
<value>classpath:org/springframework/beans/factory/xml/test.properties</value>
</property>
</bean>
</beans>

View File

@@ -0,0 +1,17 @@
<?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>
<bean id="a" class="org.springframework.beans.factory.xml.DependenciesBean"
dependency-check="objects">
<property name="spouse"><ref local="kerry"/></property>
<property name="age"><value>33</value></property>
<property name="name"><value>Rod</value></property>
</bean>
<bean id="kerry" class="org.springframework.beans.TestBean"
dependency-check="none">
</bean>
</beans>

View File

@@ -0,0 +1,13 @@
<?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>
<bean id="a" class="org.springframework.beans.factory.xml.DependenciesBean" dependency-check="objects">
<property name="spouse"><ref local="kerry"/></property>
</bean>
<bean id="kerry" class="org.springframework.beans.TestBean" dependency-check="none">
</bean>
</beans>

View File

@@ -0,0 +1,13 @@
<?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>
<bean id="a" class="org.springframework.beans.factory.xml.DependenciesBean"
dependency-check="simple">
<property name="age"><value>33</value></property>
<property name="name"><value>Rod</value></property>
</bean>
</beans>

View File

@@ -0,0 +1,10 @@
<?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>
<bean id="foo" class="org.springframework.beans.TestBean"/>
<bean name="otherFoo,foo" class="org.springframework.beans.TestBean"/>
</beans>

View File

@@ -0,0 +1,10 @@
<?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>
<bean id="foo" class="org.springframework.beans.TestBean"/>
<bean name="foo" class="org.springframework.beans.TestBean"/>
</beans>

View File

@@ -0,0 +1,14 @@
<?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>
<bean id="a" class="org.springframework.beans.factory.xml.DependenciesBean"
dependency-check="all">
<property name="age"><value>33</value></property>
<property name="name"><value>Rod</value></property>
</bean>
</beans>

View File

@@ -0,0 +1,16 @@
<?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>
<bean id="a" class="org.springframework.beans.factory.xml.DependenciesBean"
dependency-check="simple">
<property name ="name"><value>tony</value></property>
<property name="spouse"><ref local="kerry"></property> -->
</bean>
<bean id="kerry" class="org.springframework.beans.TestBean"
dependency-check="none">
</bean>
</beans>

View File

@@ -0,0 +1,11 @@
<?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>
<bean id="a" class="org.springframework.beans.factory.xml.DependenciesBean"
dependency-check="objects">
<!-- <property name="name"><value>Rod</value></property> -->
</bean>
</beans>

View File

@@ -0,0 +1,11 @@
<?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>
<bean id="a" class="org.springframework.beans.factory.xml.DependenciesBean"
dependency-check="simple">
<!-- <property name="name"><value>Rod</value></property> -->
</bean>
</beans>