Hi,
I am new to AOP and am currently running into problenm when trying to implement a custom aspect (interceptor) on JBoss 4.0.4GA.
I have already managed to write a working Interceptor by actually coding it inside the bean with the @AroundInvoke, but now i want to implement it like demonstrated here http://docs.jboss.org/jbossas/jboss4guide/r3/html/aop.chapt.html with having a .jar (custom Aspect) file, and jboss-aop.xml file in the deploy directoy, and annotation the method in the bean. The problem i am currently having is that it never seems to fire.
TestInterrup.java (aspect interace)
package com.jboss.aspect; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target({ElementType.METHOD}) public @interface TestInterrupt {}
package com.jboss.aspect; //import the relevant aop libs import org.jboss.aop.joinpoint.Invocation; public class TestInterruptAspect { public Object testInterrupt(Invocation invocation)throws Throwable{ //test print System.out.println("**** Interrupt fired successfully ****"); return invocation.invokeNext(); } }
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <aop> <aspect class="com.jboss.aspect.TestInterruptAspect" scope="PER_VM"/> <bind pointcut="execution(* *->@com.jboss.aspect.TestInterrupt(*))"> <advice name="testInterrupt" aspect="com.jboss.aspect.TestInterruptAspect"/> </bind> </aop>