well, i tried many things, but for the moment i can't intercept a constructor
call.
| public class HelloAOP {
| public void callMe () {
| System.out.println("AOP");
| }
| /**
| *
| */
| public static void main (String args[] ) {
| new HelloAOP().callMe();
| }
| }
|
jboss-aop.xml file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
| <aop>
| <!--aspect class="IOExceptionInjector" scope="PER_VM"/>
| <bind pointcut="call(* $instanceof{java.io.BufferedReader}->readLine())
AND within(HelloAOP)">
| <advice name="throwIO" aspect="IOExceptionInjector"/>
| <interceptor class="HelloAOPInterceptor"/>
| </bind-->
| <bind pointcut="call(*->new(..))">
| <interceptor class="HelloAOPInterceptor"/>
| </bind>
| </aop>
|
import org.jboss.aop.advice.Interceptor;
| import org.jboss.aop.joinpoint.Invocation;
|
| public class HelloAOPInterceptor implements Interceptor {
|
| public String getName() {
|
| return "HelloAOPInterceptor";
| }
|
|
| public Object invoke(Invocation invocation) throws Throwable {
| System.out.println("Hello, ");
| return invocation.invokeNext();
| }
| }
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3873413#3873413
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3873413
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development