Thursday, November 17, 2011

Episode 8. What's your Aspect?

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!

VM Parameter

Example Aspect


public class OrderAspect {

    @Before("execution(* *.*(Order))") // must qualify
    public void anyCall() {
         System.out.println("Was called from anywhere");

Example aop.xml file

              <aspect name="OrderAspect"/>
            <weaver options="-verbose -showWeaveInfo">

Example Folder Structure



(Using aspects with annotations)

No comments:

Post a Comment