I am trying to play with AspectJ and run time weaving. I have created an aspect
@Aspect(value = "TraceAspect")
public class TraceAspect {
@Around("execution(* *(..))")
public Object around(ProceedingJoinPoint invocation) throws Throwable{
System.out.println(String.format("Invocing %s", invocation.getSignature().getName()));
try {
Object ret = invocation.proceed();
System.out.println(String.format("Done Invocing %s", invocation.getSignature().getName()));
return ret;
} catch (Throwable throwable) {
throw throwable;
}
}
}
and my aop.xml file is
<aspectj>
<aspects>
<aspect name="TraceAscpect"></aspect>
</aspects>
<weaver options="-debug -showWeaveInfo"/>
however when I run the program I get exception -
java.lang.RuntimeException: Cannot register non aspect: TraceAscpect , TraceAscpect
What did I forget to add?
Looks like you have spelt the name of your aspect wrong in your XML definition, it should be TraceAspect and you've put TraceAscpect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With