Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] @Pointcut("@target ...) matching all ... intended

That is going to result in a runtime test for the annotation.
Answering from an AspectJ point of view, the type involved at runtime
may be different to that involved at compile time (a subtype or impl)
so we can't statically match @target reliably.  Whether this could be
optimized in a Spring AOP scenario, I don't know.  A statically
matching pointcut would be:

within(@Service *)

cheers,
Andy

On 12 December 2011 09:11, Neale Upstone <neale@xxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> Is there a reason why this seems to match all when using Spring proxy
> based AOP?
>
>        @Pointcut("@target(org.springframework.stereotype.Service)")
>        void service() {}
>
> I'd take a guess at it being something to do with the proxy target not
> being known at the point of creating the proxy, but it's not obvious.
>
> Cheers,
>
> Neale
>
> --
>  Neale Upstone
>  neale@xxxxxxxxxxxxxxxx
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top