solomon_13000 (34) [Avatar] Offline
#1
Did I implement AspectJ correctly? I didn't see any results.

AspectJ.java

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class AspectJ {

@Pointcut("execution(public * *(..))")
private void publicMethod(){
}

public void print(){
System.out.println("hello world");
}
}


Driver.java

public class Driver {
public static void main(String args[]){
AspectJ j = new AspectJ();
j.publicMethod();
}
}
ramnivas (171) [Avatar] Offline
#2
Re: AspectJ Implementation
You don't have any advice defined. I think you need to learn the core concepts of AOP/AspectJ, first.

-Ramnivas