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

Spring Framework example source code file (proxyFactoryTests.xml)

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

check, global, globalintroductionadvice, invalid, must, note, pointcutforvoid, pointcutforvoid, public, spring//dtd, they, they, utf-8, will

The Spring Framework proxyFactoryTests.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>

	<!-- Simple target -->
	<bean id="test" class="org.springframework.beans.TestBean">	
		<property name="name">custom
		<property name="age">666
	</bean>

	<bean id="debugInterceptor" class="org.springframework.aop.interceptor.NopInterceptor"/>

	<bean id="test1" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="interfaces">org.springframework.beans.ITestBean
		<property name="target">
		<property name="interceptorNames">debugInterceptor		
	</bean>
	
	<!--
		Check that invoker is automatically added to wrap target.
		Non pointcut bean name should be wrapped in invoker.
	-->
	<bean id="autoInvoker" class="org.springframework.aop.framework.ProxyFactoryBean">

		<!--
			Aspect interfaces don't need to be included here.
			They may, for example, be added by global interceptors.
		 -->
		<property name="interfaces">org.springframework.beans.ITestBean
		
		<!--
			Note that "test" is a target. An InvokerInterceptor
			will be added automatically.
		-->
		<property name="interceptorNames">global*,test
		
	</bean>
	
	<bean id="prototype" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="interfaces">
			<value>
 				org.springframework.beans.ITestBean
 			</value>
		</property>
		<property name="singleton">false
		<property name="interceptorNames">test
	</bean>
	
	<bean id="test2" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="proxyInterfaces">
			<value>
 				org.springframework.beans.ITestBean
 			</value>
		</property>
		<property name="singleton">false
		<property name="targetName">test
	</bean>
	
	<bean id="test3" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="autodetectInterfaces">true
		<property name="target">
		<property name="interceptorNames">debugInterceptor
	</bean>

	<bean id="test4" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="autodetectInterfaces">true
		<property name="singleton">false
		<property name="targetName">test
	</bean>

	<bean id="testCircle1" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="autodetectInterfaces">true
		<property name="targetName">testCircleTarget1
	</bean>

	<bean id="testCircleTarget1" class="org.springframework.beans.TestBean">
		<property name="name">custom
		<property name="age">666
		<property name="spouse">
	</bean>

	<bean id="testCircle2" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="autodetectInterfaces">true
		<property name="targetName">testCircleTarget2
	</bean>

	<bean id="testCircleTarget2" class="org.springframework.beans.TestBean">
		<property name="name">custom
		<property name="age">666
		<property name="spouse">
	</bean>

	<bean id="pointcuts" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="proxyInterfaces">org.springframework.beans.ITestBean
		<property name="interceptorNames">pointcutForVoid
		<property name="targetName">test
	</bean>
	
	<bean id="pointcutForVoid" class="org.springframework.aop.framework.ProxyFactoryBeanTests$PointcutForVoid"/>

	<!--
		Invalid test for global pointcuts.
		Must have target because there are no interceptors.
	-->
	<!--
	<bean id="noInterceptorNamesWithoutTarget" 
			class="org.springframework.aop.framework.ProxyFactoryBean"
	>	
		<property name="proxyInterfaces">org.springframework.beans.ITestBean			
		
	</bean>
	
	<bean id="noInterceptorNamesWithTarget" 
			class="org.springframework.aop.framework.ProxyFactoryBean"
	>	
		<property name="proxyInterfaces">org.springframework.beans.ITestBean	
		<property name="target">					
		
	</bean>
	-->
	
	<bean id="validGlobals" scope="singleton" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="proxyInterfaces">org.springframework.context.ApplicationListener
		<property name="interceptorNames">debugInterceptor,global*,target2
	</bean>

	<!--
		Global debug interceptor
	-->
	<bean id="global_debug" class="org.springframework.aop.interceptor.DebugInterceptor"/>

	<!--
		Will add aspect interface to all beans exposing globals
	-->
	<bean id="global_aspectInterface" class="org.springframework.aop.framework.ProxyFactoryBeanTests$GlobalIntroductionAdvice"/>

	<bean id="prototypeLockMixinAdvisor" class="org.springframework.aop.framework.LockMixinAdvisor" scope="prototype"/>

	<bean id="prototypeTestBean" class="org.springframework.beans.TestBean" scope="prototype"/>

	<bean id="prototypeTestBeanProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="interfaces">org.springframework.beans.ITestBean
		<property name="singleton">false
		<property name="interceptorNames">
			<list>
				<value>prototypeLockMixinAdvisor
				<value>prototypeTestBean
			</list>
		</property>
	</bean>

	<bean id="prototypeLockMixinInterceptor" class="org.springframework.aop.framework.LockMixin" scope="prototype"/>

	<bean id="prototypeTestBeanProxySingletonTarget" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="interfaces">
			<list>
				<value>org.springframework.beans.ITestBean
				<value>org.springframework.aop.framework.Lockable
			</list>
		</property>
		<property name="singleton">false
		<property name="target">
		<property name="interceptorNames">
			<list>
				<value>prototypeLockMixinInterceptor
			</list>
		</property>
	</bean>

</beans>

Other Spring Framework examples (source code examples)

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