Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ Unit Testing

manuel aldana schrieb:

Hi Manuel,
I'm relatively new to AOP and AspectJ, but IIRC it's possible to
instantiate an aspect using AspectClass.asAspect(). ICRR if this is
possible only for aspects declared as not singleton, of if also when an
aspect is a singleton (the default case) this static method will return
the default instance (but I think this is the case).

Using it you should not need to pollute your aspect with public static
stuff only for testing.



hi, good to know.
will refactor my aspect to common instance dependency injection and will remove the protected static accesses.
yes it works (though a bit differently because i am using annotations).
to get to the aspect instance you need to call:
MyAspect aspectInstance=Aspects.aspectOf(MyAspect.class);

then you can access object members declared.

--
manuel aldana
aldana@xxxxxx
software-engineering blog: www.aldana-online.de



Back to the top