Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load time weaving in AspectJ using aop.xml

From what I understand, for load time weaving to work using an aop.xml file, it must be placed in META-INF. Is there a way to get around this and use an aop.xml (or any xml file) in any directory? Thanks.

like image 782
meteoritepanama Avatar asked Jul 23 '10 02:07

meteoritepanama


People also ask

What is weaving in AspectJ?

Weaving in AspectJ Classes are defined using Java syntax. The weaving process consists of executing the aspect advice to produce only a set of generated classes that have the aspect implementation code woven into it.

What is AOP XML?

An aop. xml file contains two key sections: "aspects" defines one or more aspects to the weaver and controls which aspects are to be used in the weaving process; "weaver" defines weaver options and which types should be woven.

What is weaving in AOP?

Weaving: linking aspects with other application types or objects to create an advised object. This can be done at compile time (using the AspectJ compiler, for example), load time, or at runtime.


1 Answers

You can use the system property org.aspectj.weaver.loadtime.configuration to point to another AspectJ config file. For example:

-D org.aspectj.weaver.loadtime.configuration=META-INF/myaop.xml
like image 133
Adriaan Avatar answered Oct 14 '22 03:10

Adriaan