Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] creating/configuring aspects during runtime and weaver exposure of concrete-aspects

On 31 March 2010 00:30, Ashank <k_arvind_shankar@xxxxxxxxx> wrote:
> Is there anyway to create/configure aspects during runtime?

Configurable behaviour is only possible if you weave in aspects that
are configurable - if they check a static boolean before doing
something (perhaps in an 'if' pointcut clause) then you can tweak the
boolean to switch them on and off.  We allow class redefinition via
the AspectJ transformer so you could redefine the aspect and the
affected target at runtime, but I can't make guarantees that will
work.  What do you want to do?

> I looked in a
> bunch of places but there seems to be nothing on that capability. From AJ5,
> I read that classes are 'reweavable'. Why would this be needed if aspects
> can't be created/configured during runtime?

reweavable is for weaving something twice. For example compile time
weaving it then binary weaving it then loadtime weaving it.
reweavable support is what makes that work reliably.

> Also, please confirm if I understood this excerpt from the AspectJ
> developer's guide:
> "A limitation of the implementation of this feature in AspectJ 1.5.0 is that
> aspects defined using aop.xml are not exposed to the weaver. This means that
> they are not affected by advice and ITDs defined in other aspects. Support
> for this capability will be considered in a future release. "
> Does this mean that they are not exposed as a joinpoint (to be advised) and
> that new fields/members/parents/interfaces cannot be added to concrete
> aspects?

The concrete aspects you can define in aop.xml are extremely limited
in what they can specify/do.  That said, I don't believe the compiler
still has the restriction you describe there (1.5.0 was a long time
ago)

cheers,
Andy


Back to the top