Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: Initialization + Annoation Pointcut

I may have made some progress...

I'm trying the pointcut:

after() : !within(HOGAspect) && @annotation(WebService)

This *is* running the code in the advice, but at the same time I get the warning:

HOGAspect has not been applied [Xlint:adviceDidNotMatch]

Also, I'm trying to get the this object and it is coming back as null:

Object thisClass = thisJoinPoint.getThis();

Any ideas?

--
Evan

On May 14, 2009, at 3:04 PM, Evan Moseman wrote:

I'm trying to write a pointcut that will inject advice after any class with the @WebService annotation is instantiated.

I've tried dozens of different combinations of pointcut logic and nothing seems to work correctly.

My latest attempt is this:

after() : execution(*.new(..)) && @annotation(WebService) && ! within(HOGAspect)

I would also be wiling to use a class name wildcard like ? ServiceImpl but I can't a match for that either.

The purpose of the advice is to instantiate a performance collection object for each of these classes that is instantiated. Then another pointcut will catch all of the method executions and collection stats about timing,etc...

I thought that aspectj would be a perfect match for this, but 3 hours and many attempts later and nothing is matching.

Any help / ideas are greatly appreciated, thanks!

--
Evan



Back to the top