/*
Pro Spring
By Rob Harrop
Jan Machacek
ISBN: 1-59059-461-4
Publisher: Apress
*/
///////////////////////////////////////////////////////////////////////////////////////
//File: dpac.xml
///////////////////////////////////////////////////////////////////////////////////////
public class AutoBean {
public void foo() {
System.out.println("foo()");
}
}
///////////////////////////////////////////////////////////////////////////////////////
public class OtherBean {
public void foo() {
System.out.println("foo()");
}
}
///////////////////////////////////////////////////////////////////////////////////////
import org.springframework.aop.support.AopUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class DefaultCreatorExample {
public static void main(String[] args) {
ApplicationContext ctx = new FileSystemXmlApplicationContext(
"build/dpac.xml");
AutoBean autoBean = (AutoBean)ctx.getBean("autoBean");
OtherBean otherBean = (OtherBean)ctx.getBean("otherBean");
autoBean.foo();
System.out.println(AopUtils.isAopProxy(autoBean));
otherBean.foo();
System.out.println(AopUtils.isAopProxy(otherBean));
}
}
DefaultCreatorExample.zip( 1,479 k)