<?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
	http://www.springframework.org/schema/aop 
	http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

	<bean id="item1Bean" class="br.org.senacagil.ItemVenda">
		<constructor-arg>
			<value>laranja</value>
		</constructor-arg>
		<constructor-arg type="double">
			<value>6</value>
		</constructor-arg>
		<constructor-arg type="int">
			<value>2</value>
		</constructor-arg>
	</bean>
	<bean id="item2Bean" class="br.org.senacagil.ItemVenda">
		<constructor-arg value="laranja" index="0" />
		<constructor-arg type="double" value="6" index="1" />
		<constructor-arg type="int" value="2" index="2" />
	</bean>
	<bean id="item3Bean" class="br.org.senacagil.ItemVenda">
		<constructor-arg value="pera" index="0" />
		<constructor-arg type="double" value="10" index="1" />
		<constructor-arg type="int" value="4" index="2" />
	</bean>

	<bean id="venda1Target" class="br.org.senacagil.Venda">
		<property name="numero" value="01" />
		<property name="data" value="20080602"></property>
		<property name="itens">
			<list>
				<ref bean="item1Bean" />
				<ref bean="item2Bean" />
				<ref bean="item3Bean" />
			</list>
		</property>
	</bean>
	<bean id="venda2Target" class="br.org.senacagil.Venda">
		<property name="numero" value="02" />
		<property name="data" value="20080602"></property>
		<property name="itens">
			<list>
				<ref bean="item1Bean" />
				<ref bean="item3Bean" />
			</list>
		</property>
	</bean>

    <!--  Advices -->
	<bean id="logAdvice" class="br.org.senacagil.LogAdvice" />
	<bean id="countingAfterAdvice" class="br.org.senacagil.CountingAfterAdvice" />
	<bean id="debugInterceptor" class="br.org.senacagil.DebugInterceptor" />

	<bean id="venda1" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="proxyInterfaces">
			<value>br.org.senacagil.IVenda</value>
		</property>

		<property name="target">
			<ref local="venda1Target" />
		</property>
		<property name="interceptorNames">
			<list>
				<value>debugInterceptor</value>
				<value>logAdvice</value>
				<value>countingAfterAdvice</value>
			</list>
		</property>
	</bean>

	<bean id="venda2" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="proxyInterfaces">
			<value>br.org.senacagil.IVenda</value>
		</property>

		<property name="target">
			<ref local="venda2Target" />
		</property>
		<property name="interceptorNames">
			<list>
				<value>debugInterceptor</value>
				<value>logAdvice</value>
				<value>countingAfterAdvice</value>
			</list>
		</property>
	</bean>

	<bean id="cliente1" class="br.org.senacagil.Cliente">
		<property name="nome" value="Maria" />
		<property name="saldo" value="10" />
		<property name="listVendas">
			<list>
				<ref bean="venda1" />
				<ref bean="venda2" />
			</list>
		</property>
	</bean>
	
	<bean id="cliente2" class="br.org.senacagil.Cliente">
		<property name="nome" value="Joao" />
		<property name="saldo" value="30" />
		<property name="listVendas">
			<list>
				<ref bean="venda2" />
			</list>
		</property>
	</bean>
</beans>