Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] getting Annotated field element

Hi i had a problem in accessing the Annotated field from AspectJ

Here is my sample class:

import javax.ejb.Remote;
import java.lang.annotation.*;
import javax.ejb.EJB;

@Remote(MyAccount.class)

public class MyAccountBean implements MyAccount
{
       @EJB(beanName="MyJndi")
       private MyService service;
       public void sayHelloFromAccountBean(){
       System.out.println("Say Hello");
       }
}
And the Aspect for this is :

import javax.ejb.EJB;
import javax.naming.Context;
public aspect FiledAspect {

String around(EJB annotation) : get(@EJB * * *) && @annotation(annotation) {
System.out.println("********** Finded Annotated Ellement ");
return "";
   }

}
When i compiled using ajc as : ajc -1.5 MyAccountBean.java FieldAspect.aj
I'm getting a warning as "advice defined in FiledAspect has not been applied [Xlint:adviceDidNotMatch] ".
So how to get the Annotated filed "@EJB" .
Thanx in advance.

Back to the top