[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] getting Annotated field element
|
I can't see any field-get join points in your program so your advice
does not match. I can see the field you want to match, but I can't
see anywhere that accesses it - it is those places that would be
matched by your aspect, for example change your println() to:
System.out.println(service);
and it will match. because 'service' is now being accessed.
Andy.
2008/5/22 Ziaul Haque <ziaul.n@xxxxxxxxx>:
> 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.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>