Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re :Re:[aspectj-users] Load-time weaving problem

Hi Stefan,

Never mind, We all do mistakes. :)
Well, if you are talking about the text "<aspect name="com.example.foo.aspects.SomeAspect"/>" in aop.xml file, I would say:
Yes. You will have to specify the aspect name inside aop.xml. The reason is the flexibility to add/drop the aspects you want to weave on your target program at load-time.

So, if you have 1 target program and 3 aspects weaving some code on it (each having separate pointcuts defined), you can tell the aj exactly which aspects should throw their code on target program at load-time. eg. you have AspectA, AspectB and AspectC and you just want AspectA and AspectC to weave at load time, you can do it using:
  <aspect name="AspectA" />
  <aspect name="AspectC" />

Later on, if you want to change the weaver to AspectB and AspectC, you can do it by simply modifying aop.xml

I hope I answered your question.

Thanks,
Kunal.

On Tue, 26 Feb 2008 11:02:36 +0100 Stefan Kreutter wrote
Kunal,

thanks for your reply!

On 25.02.2008, at 21:26, Kunal Pathak wrote:

> Are you using the aj command to see the output? Have you created the
> aop.xml that is essential for weaving the aspects at load-time?

No, I'm using the java executable of Mac OS X and provide a java
agent. Like: java -javaagent:lib/aspectjweaver.jar ....

The problem was to not have an aop.xml (stupid me!) but now I have a
question regarding this file. I'm using the 'new' @AspectJ syntax and
my aspects are annotated with @Aspect. Load-time weaving now works
with a aop.xml like this:










Unfortunately I have to explicitly name the aspect by it's class name.
I think the weaver could be smart enough to find the annotated classes
automatically? Is that possible as well?

Best regards and thanks in advance,
Stefan



Back to the top