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

Spring Framework example source code file (proxyFactoryTargetSourceTests.xml)

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

bean, beanfactory, doctype, if, ioc, ioc, no, no, note, public, simple, spring//dtd, type, utf-8

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

<!--
	Tests for independent prototype behaviour.
-->

<beans>

	<!-- Simple target -->
	<bean id="target" class="org.springframework.beans.TestBean">	
		<!-- initial value :-) -->
		<property name="name">Adam
	</bean>
	
	<bean id="nopInterceptor" class="org.springframework.aop.interceptor.NopInterceptor">
	</bean>
	
	<bean id="countingBeforeAdvice"
		class="org.springframework.aop.framework.CountingBeforeAdvice"
	/>
	
	<!--
		Note that there's normally no reason to create objects of this type
		in a BeanFactory. If for some strange reason you want to, use Type 3 IoC.
	-->
	<bean id="targetSource" class="org.springframework.aop.target.SingletonTargetSource">
		<constructor-arg>
	</bean>

	<bean id="directTarget"
		class="org.springframework.aop.framework.ProxyFactoryBean"> 
		<property name="interceptorNames" value="countingBeforeAdvice,nopInterceptor,target"/>
		<property name="proxyTargetClass" value="true"/>
	</bean>
	
	<bean id="viaTargetSource"
		class="org.springframework.aop.framework.ProxyFactoryBean"> 
		<property name="interceptorNames">nopInterceptor,targetSource
		<property name="proxyTargetClass" value="true"/>		
	</bean>
	
	<bean id ="unsupportedInterceptor"
		class="org.springframework.aop.framework.UnsupportedInterceptor"
	/>
	
	<!--
		No target or target source, just the interceptor
	-->
	<bean id="noTarget"
		class="org.springframework.aop.framework.ProxyFactoryBean"> 
		<property name="proxyInterfaces">org.springframework.beans.ITestBean
		<property name="interceptorNames">nopInterceptor,unsupportedInterceptor
	</bean>

</beans>		
	
	

Other Spring Framework examples (source code examples)

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