alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Spring Framework example source code file (test.xml)

This example Spring Framework source code file (test.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Spring Framework tags/keywords

cdata, check, check, doctype, factory, factory, factorybean, i, i'm, public, rod, spring//dtd, test, utf-8

The Spring Framework test.xml source code

<?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="validEmptyWithDescription" class="org.springframework.beans.TestBean">
		<description>
			I have no properties and I'm happy without them.
		</description>
	</bean>

	<!--
		Check automatic creation of alias, to allow for names that are illegal as XML ids.
	-->
	<bean id="aliased" class="  org.springframework.beans.TestBean  " name="myalias">
		<property name="name">aliased
	</bean>

	<alias name="aliased" alias="youralias"/>

	<alias name="multiAliased" alias="alias3"/>

	<bean id="multiAliased" class="org.springframework.beans.TestBean" name="alias1,alias2">
		<property name="name">aliased
	</bean>

	<alias name="multiAliased" alias="alias4"/>

	<bean class="org.springframework.beans.TestBean" name="aliasWithoutId1,aliasWithoutId2,aliasWithoutId3">
		<property name="name">aliased
	</bean>

	<bean class="org.springframework.beans.TestBean">
		<property name="name">
	</bean>

	<bean class="org.springframework.beans.factory.xml.DummyReferencer"/>

	<bean class="org.springframework.beans.factory.xml.DummyReferencer"/>

	<bean class="org.springframework.beans.factory.xml.DummyReferencer"/>

	<bean id="rod" class="org.springframework.beans.TestBean">
		<property name="name">Rod
		<property name="age">31
		<property name="spouse">
		<property name="touchy">
	</bean>

	<bean id="roderick" parent="rod">
		<property name="name">Roderick
		<!-- Should inherit age -->
	</bean>

	<bean id="kerry" class="org.springframework.beans.TestBean">
		<property name="name">Kerry
		<property name="age">34
		<property name="spouse">
		<property name="touchy">
	</bean>

	<bean id="kathy" class="org.springframework.beans.TestBean" scope="prototype">
		<property name="name">Kathy
		<property name="age">28
		<property name="spouse">
	</bean>

	<bean id="typeMismatch" class="org.springframework.beans.TestBean" scope="prototype">
		<property name="name">typeMismatch
		<property name="age">34x
		<property name="spouse">
	</bean>

	<!-- Test of lifecycle callbacks -->
	<bean id="mustBeInitialized" class="org.springframework.beans.factory.MustBeInitialized"/>

	<bean id="lifecycle" class="org.springframework.beans.factory.LifecycleBean"
		  init-method="declaredInitMethod">
		<property name="initMethodDeclared">true
	</bean>

	<bean id="protectedLifecycle" class="org.springframework.beans.factory.xml.ProtectedLifecycleBean"
		  init-method="declaredInitMethod">
		<property name="initMethodDeclared">true
	</bean>

	<!-- Factory beans are automatically treated differently -->
	<bean id="singletonFactory"	class="org.springframework.beans.factory.DummyFactory">
	</bean>

	<bean id="prototypeFactory"	class="org.springframework.beans.factory.DummyFactory">
		<property name="singleton">false
	</bean>

	<!-- Check that the circular reference resolution mechanism doesn't break
	     repeated references to the same FactoryBean -->
	<bean id="factoryReferencer" class="org.springframework.beans.factory.xml.DummyReferencer">
		<property name="testBean1">
		<property name="testBean2">
		<property name="dummyFactory">
	</bean>

	<bean id="factoryReferencerWithConstructor" class="org.springframework.beans.factory.xml.DummyReferencer">
		<constructor-arg>
		<property name="testBean1">
		<property name="testBean2">
	</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">
		<property name="testBean2">
	</bean>

	<bean id="listenerVeto" class="org.springframework.beans.TestBean">
		<property name="name">listenerVeto
		<property name="age">66
	</bean>

	<bean id="validEmpty" class="org.springframework.beans.TestBean"/>

	<bean id="commentsInValue" class="org.springframework.beans.TestBean">
	  <property name="name">this is a ]]>
	</bean>

</beans>

Other Spring Framework examples (source code examples)

Here is a short list of links related to this Spring Framework test.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.