Hi,

In my app module, I have a service advisor method defined like the
following:

        @Advise

@NeedsAdvice

public void adviseMe(MyAdvisor myAdvisor, MethodAdviceReceiver
methodAdviceReceiver, Logger logger)

{

logger.debug("Advising");

myAdvisor.addAdvice(methodAdviceReceiver);

}

@NeedsAdvise is defined as below:


@Retention(RetentionPolicy.RUNTIME)

@Target({ElementType.TYPE, ElementType.METHOD})

public @interface NeedsAdvice{}


The service that is to be advised is defined as below:


@NeedsAdvice

public class MyServiceImpl implements MyService {

...

..

}





However, when the application runs, the adviceMe method is never invoked
and the methods calls are never intercepted.

When I change the method signature to include the service ID being advised,
everything works as expected:

public void adviseMyService(MyAdvisor myAdvisor, MethodAdviceReceiver
methodAdviceReceiver, Logger logger)

{

logger.debug("Advising");

myAdvisor.addAdvice(methodAdviceReceiver);

}


Not sure what am missing with marker annotations? Would appreciate any help.


Sanket

Reply via email to