Per Instance Interception
Per Instance Interception Let's look at the first type of Dynamic AOP. You can add interceptors on a per instance basis using the org.jboss.aop.InstanceAdvisor API. (see the javadocs). All "prepared" java classes implement org.jboss.aop.Advised. Advised has a method _getInstanceAdvisor that gives you access to the InstanceAdvisor api. Added interceptors are put before and after the main ClassAdvisor interceptor chain. InstanceAdvisor.insertInterceptor puts an interceptor at the beginning of the advice/interceptor chain. InstanceAdvisor.appendInterceptor puts it at the end. Another quirkiness about this api is that the interceptors will be added to every chain of every method, field, or constructor so the added interceptor must do a runtime check to determine if it should execute or not. In the future we plan to have more fine-grained control over this, but we didn't get to it in the 1.0Beta release, sorry! You can see this in action within Driver.java System.out.println("--- adding instance interceptors ---"); Advised advised = (Advised)pojo; advised._getInstanceAdvisor().insertInterceptor(new InstanceInterceptor()); Driver.java typecasts the pojo instance to Advised. From the Advised interface, the code gets access to the InstanceAdvisor API and inserts an interceptor.