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

Spring Framework example source code file (advisorAutoProxyCreator.xml)

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

common, depending, doctype, often, propagation_required, propagation_required, public, spring//dtd, test, the, the, these, these, thus

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

<!--
	Common bean definitions for auto proxy creator tests.
-->
<beans>

	<description>
		Matches all Advisors in the factory: we don't use a prefix
	</description>

	<bean id="aapc" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>

	<!--
		Depending on the order value, these beans should appear
		before or after the transaction advisor. Thus we configure
		them to check for or to refuse to accept a transaction.
		The transaction advisor's order value is 10.
	-->
	<bean id="orderedBeforeTransaction" class="org.springframework.aop.framework.autoproxy.OrderedTxCheckAdvisor">
		<property name="order">9
		<property name="requireTransactionContext">false
	</bean>
	
	<bean id="orderedAfterTransaction" class="org.springframework.aop.framework.autoproxy.OrderedTxCheckAdvisor">
		<property name="order">11
		<property name="requireTransactionContext">true
	</bean>
	
	<bean id="orderedAfterTransaction2" class="org.springframework.aop.framework.autoproxy.OrderedTxCheckAdvisor">
		<!-- Don't set order value: should remain Integer.MAX_VALUE, so it's non-ordered -->
		<property name="requireTransactionContext">true
	</bean>

	<!-- Often we can leave the definition of such infrastructural beans to child factories -->
	<bean id="txManager" class="org.springframework.transaction.CallCountingTransactionManager"/>
	
	<bean id="tas" class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">
		<property name="properties">
			<props>
				<prop key="setA*">PROPAGATION_REQUIRED
				<prop key="rollbackOnly">PROPAGATION_REQUIRED
				<prop key="echoException">PROPAGATION_REQUIRED,+javax.servlet.ServletException,-java.lang.Exception
			</props>
		</property>
	</bean>

	<bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
		<property name="transactionManager">
		<property name="transactionAttributeSource">
	</bean>

	<bean id="txAdvisor" class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
		<property name="transactionInterceptor">
		<property name="order">10
	</bean>

	<!-- ====== Test for prototype definitions to try to provoke circular references ========================= -->
	<!--
		This advisor should never match and should not change how any of the tests run,
		but it's a prototype referencing another (unused) prototype, as well as a
		singleton, so it may pose circular reference problems, or an infinite loop.
	-->
	<bean id="neverMatchAdvisor" class="org.springframework.aop.framework.autoproxy.NeverMatchAdvisor"
			scope="prototype">
		<property name="dependencies">
			<list>
				<ref local="singletonDependency"/>
				<ref local="prototypeDependency"/>
			</list>
		</property>
	</bean>
	
	<!-- These two beans would otherwise be eligible for autoproxying -->
	
	<bean id="singletonDependency" class="org.springframework.beans.TestBean" scope="singleton"/>
		
	<bean id="prototypeDependency" class="org.springframework.beans.TestBean" scope="prototype"/>
	
	<!-- ====== End test for prototype definitions to try to provoke circular references ========================= -->

	<bean class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
		<property name="advice">
		<property name="pattern">org.springframework.beans.ITestBean.getName
	</bean>

	<bean id="countingAdvice" class="org.springframework.aop.framework.CountingAfterReturningAdvice"/>

	<bean id="test" class="org.springframework.beans.TestBean">
		<property name="age">4
	</bean>
	
	<bean id="noSetters" class="org.springframework.aop.framework.autoproxy.NoSetters"/>

	<bean id="rollback" class="org.springframework.aop.framework.autoproxy.Rollback"/>

	<!-- The following beans test whether auto-proxying falls over for a null value -->

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

	<bean id="nullValueReturned" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
		<property name="targetObject" ref="tb"/>
		<property name="targetMethod" value="getSpouse"/>
	</bean>

</beans>		

Other Spring Framework examples (source code examples)

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