Episode 8. What's your Aspect? - a podcast by Freddy Guime & Bob Paulin
from 2011-11-17T21:00
In this episode we go over Aspects (and AspectJ), what really is, and when to use them. It turns out, that there is nothing misterious about them! We also cover how to set-up Aspects for J2SE so you can start using them immediately!
Questions, feedback or comments! comments@javapubhouse.com
VM Parameter
-javaagent:dep/aspectjweaver.jar
Example Aspect
@Aspect
public class OrderAspect {
@Before("execution(* *.*(Order))") // must qualify
public void anyCall() {
System.out.println("Was called from anywhere");
}
}
Example aop.xml file
Example Folder Structure
src
|
|-META-INF
|
|-aop.xml
References:
http://www.eclipse.org/aspectj/doc/released/adk15notebook/ataspectj-pcadvice.html
http://www.eclipse.org/aspectj/doc/next/quick5.pdf
http://blog.espenberntsen.net/2010/03/20/aspectj-cheat-sheet/
(Using aspects with annotations)
http://stackoverflow.com/questions/2011089/aspectj-pointcut-for-all-methods-of-a-class-with-specific-annotation
Further episodes of Java Pub House
Further podcasts by Freddy Guime & Bob Paulin
Website of Freddy Guime & Bob Paulin