Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] aspectj configuration question

> 1. Will servicesA be woven with all the three aspects (aspectA,B,C)?
Correct.

> 2. If Yes, is there any way to configure specific aspect to weave only
> specific class(es), example: AspectA weaves only servicesA?

Not directly, but there are two suggestions:

1. Within each specific aspect, you can add a within() pointcut to
each of your advice declarations and this will ensure that AspectA is
only applied to ServiceA.  Eg, something like this:

pointcut canApplyTo() : within(ServiceA);

after() : doingSomethingAwesome() && canApplyTo() {
   ...
}

2. Separate each of your service and aspects into separate modules to
pair serviceA and aspectA, etc.

I'd strongly recommend #1.


Back to the top