Slide 41
Slide 41 text
SpringSource Confidential. Do not distribute without express permission
An @Aspect, applied with XML
ctx = new ClassPathXmlApplicationContext("app-config.xml");
Foo foo = ctx.getBean("foo");
foo.setCacheSize(100);
@Aspect
public class PropertyChangeTracker {
@Before("execution(void set*(*)) && target(obj) && args(value)")
public void trackChange(JoinPoint jp, Object obj, Object value) {
logger.info(format("%s property about to change to '%s' on object '%s'",
jp.getSignature().getName(), value, obj));
}
}
bean is a Spring-generated
AOP proxy
INFO setCacheSize about to change to '100' on object 'foo'