<?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="prototypeTest" class="org.springframework.aop.interceptor.SideEffectBean" scope="prototype">
		<property name="count"><value>10</value></property>
	</bean>
	
	<bean id="poolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSource">	
		<property name="targetBeanName"><value>prototypeTest</value></property>
		<property name="maxSize"><value>25</value></property>
	</bean>
	
	<bean id="poolConfigAdvisor" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
		<property name="targetObject"><ref local="poolTargetSource" /></property>
		<property name="targetMethod"><value>getPoolingConfigMixin</value></property>
	</bean>
	
	<bean id="nop" class="org.springframework.aop.interceptor.NopInterceptor"/>

	<!--
		This will create a bean for each thread ("apartment")
	-->
	<bean id="pooled"  class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="targetSource"><ref local="poolTargetSource"/></property>
		<property name="interceptorNames"><value>nop</value></property>
	</bean>
	
	<bean id="pooledNoInterceptors"  class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="targetSource"><ref local="poolTargetSource"/></property>
	</bean>
	
	<bean id="pooledWithMixin" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="targetSource"><ref local="poolTargetSource"/></property>
		<property name="interceptorNames"><value>poolConfigAdvisor</value></property>
		<!-- Necessary as have a mixin and want to avoid losing the class,
			 because there's no target interface -->
		<property name="proxyTargetClass"><value>true</value></property>
	</bean>

	<!-- Serialization tests using serializable target and advice -->
	<bean id="serializableNop" class="org.springframework.aop.interceptor.SerializableNopInterceptor" />
	
	<bean id="prototypePerson" class="org.springframework.beans.SerializablePerson" scope="prototype"/>

	<bean id="personPoolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSource">	
		<property name="targetBeanName"><value>prototypePerson</value></property>
		<property name="maxSize"><value>10</value></property>
	</bean>
	
	<bean id="pooledPerson" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="targetSource"><ref local="personPoolTargetSource"/></property>
		<property name="interceptorNames"><value>serializableNop</value></property>
		
	</bean>

	<bean id="maxSizePooledPerson" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="targetSource">
			<bean class="org.springframework.aop.target.CommonsPoolTargetSource">
				<property name="targetBeanName" value="prototypePerson"/>
				<property name="maxSize" value="10"/>
				<property name="maxWait" value="1"/>
			</bean>
		</property>
		<property name="interceptorNames"><value>serializableNop</value></property>
	</bean>

</beans>		
