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

Spring Framework example source code file (collectionMerging.xml)

This example Spring Framework source code file (collectionMerging.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

eva, greenwood, harrop, harrop, johnson, juergen, kerry, kerry, rob, rob, rod, sall, sally, sally

The Spring Framework collectionMerging.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="parentWithList" class="org.springframework.beans.TestBean">
		<property name="someList">
			<list>
				<value>Rob Harrop
				<value>Rod Johnson
			</list>
		</property>
	</bean>

	<bean id="childWithList" parent="parentWithList">
		<property name="someList">
			<list merge="true">
				<value>Juergen Hoeller
			</list>
		</property>
	</bean>

	<bean id="childWithListOfRefs" parent="parentWithList">
		<property name="someList">
			<list merge="true">
				<bean class="org.springframework.beans.TestBean"/>
			</list>
		</property>
	</bean>

	<bean id="parentWithSet" class="org.springframework.beans.TestBean">
		<property name="someSet">
			<set>
				<value>Rob Harrop
			</set>
		</property>
	</bean>

	<bean id="childWithSet" parent="parentWithSet">
		<property name="someSet">
			<set merge="true">
				<value>Sally Greenwood
			</set>
		</property>
	</bean>

	<bean id="childWithSetOfRefs" parent="parentWithSet">
		<property name="someSet">
			<set merge="true">
				<bean class="org.springframework.beans.TestBean">
					<property name="name" value="Sally"/>
				</bean>
			</set>
		</property>
	</bean>

	<bean id="parentWithMap" class="org.springframework.beans.TestBean">
		<property name="someMap">
			<map>
				<entry key="Rob" value="Sall"/>
				<entry key="Juergen" value="Eva"/>
			</map>
		</property>
	</bean>

	<bean id="childWithMap" parent="parentWithMap">
		<property name="someMap">
			<map merge="true">
				<entry key="Rod" value="Kerry"/>
				<entry key="Rob" value="Sally"/>
			</map>
		</property>
	</bean>

	<bean id="childWithMapOfRefs" parent="parentWithMap">
		<property name="someMap">
			<map merge="true">
				<entry key="Rob">
					<bean class="org.springframework.beans.TestBean">
						<property name="name" value="Sally"/>
					</bean>
				</entry>
			</map>
		</property>
	</bean>

	<bean id="parentWithProps" class="org.springframework.beans.TestBean">
		<property name="someProperties">
			<props>
				<prop key="Rob">Sall
				<prop key="Rod">Kerry
			</props>
		</property>
	</bean>

	<bean id="childWithProps" parent="parentWithProps">
		<property name="someProperties">
			<props merge="true">
				<prop key="Juergen">Eva
				<prop key="Rob">Sally
			</props>
		</property>
	</bean>


	<bean id="parentWithListInConstructor" class="org.springframework.beans.TestBean">
		<constructor-arg index="0">
			<list>
				<value>Rob Harrop
				<value>Rod Johnson
			</list>
		</constructor-arg>
	</bean>

	<bean id="childWithListInConstructor" parent="parentWithListInConstructor">
		<constructor-arg index="0">
			<list merge="true">
				<value>Juergen Hoeller
			</list>
		</constructor-arg>
	</bean>

	<bean id="childWithListOfRefsInConstructor" parent="parentWithListInConstructor">
		<constructor-arg index="0">
			<list merge="true">
				<bean class="org.springframework.beans.TestBean"/>
			</list>
		</constructor-arg>
	</bean>

	<bean id="parentWithSetInConstructor" class="org.springframework.beans.TestBean">
		<constructor-arg index="0">
			<set>
				<value>Rob Harrop
			</set>
		</constructor-arg>
	</bean>

	<bean id="childWithSetInConstructor" parent="parentWithSetInConstructor">
		<constructor-arg index="0">
			<set merge="true">
				<value>Sally Greenwood
			</set>
		</constructor-arg>
	</bean>

	<bean id="childWithSetOfRefsInConstructor" parent="parentWithSetInConstructor">
		<constructor-arg index="0">
			<set merge="true">
				<bean class="org.springframework.beans.TestBean">
					<property name="name" value="Sally"/>
				</bean>
			</set>
		</constructor-arg>
	</bean>

	<bean id="parentWithMapInConstructor" class="org.springframework.beans.TestBean">
		<constructor-arg index="0">
			<map>
				<entry key="Rob" value="Sall"/>
				<entry key="Juergen" value="Eva"/>
			</map>
		</constructor-arg>
	</bean>

	<bean id="childWithMapInConstructor" parent="parentWithMapInConstructor">
		<constructor-arg index="0">
			<map merge="true">
				<entry key="Rod" value="Kerry"/>
				<entry key="Rob" value="Sally"/>
			</map>
		</constructor-arg>
	</bean>

	<bean id="childWithMapOfRefsInConstructor" parent="parentWithMapInConstructor">
		<constructor-arg index="0">
			<map merge="true">
				<entry key="Rob">
					<bean class="org.springframework.beans.TestBean">
						<property name="name" value="Sally"/>
					</bean>
				</entry>
			</map>
		</constructor-arg>
	</bean>

	<bean id="parentWithPropsInConstructor" class="org.springframework.beans.TestBean">
		<constructor-arg index="0">
			<props>
				<prop key="Rob">Sall
				<prop key="Rod">Kerry
			</props>
		</constructor-arg>
	</bean>

	<bean id="childWithPropsInConstructor" parent="parentWithPropsInConstructor">
		<constructor-arg index="0">
			<props merge="true">
				<prop key="Juergen">Eva
				<prop key="Rob">Sally
			</props>
		</constructor-arg>
	</bean>

</beans>

Other Spring Framework examples (source code examples)

Here is a short list of links related to this Spring Framework collectionMerging.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.