问题
I have developed a web application using Netbeans 6.7 and Ant. The webapp works, but I would like to refactor the code to use @Configurable Spring annotation for cleaner dependency injection.
I was able to get load-time weaving (LTW) of Spring aspects to work intermittently (see http://forum.springsource.org/showthread.php?t=86904).
At this point I would like to use compile-time weaving with my tool set.
Could anybody provide an Ant target that I can use to weave Spring aspects at compile time?
An extra credit will be given to anybody who explains how to configure Netbeans to execute the new Ant target right after code compilation.
Thanks.
回答1:
<iajc outjar="demo.jar">
<sourceroots>
<pathelement location=”src” />
<pathelement location=".." />
</sourceroots>
<aspectpath>
<pathelement location="org.springframework.aspects-3.0.0.RC1.jar" />
</aspectpath>
</iajc>
For a full example, see the AspectJ development guide iajc sample.
来源:https://stackoverflow.com/questions/2539183/ant-target-for-compile-time-code-instrumentation-with-spring-aspects