Monday, March 8, 2010

Annotated-Based Transaction Managment with Spring 2.5.x and AspectJ Compile Time Weaving

In this post I'll describe how to use annotated transaction management with Spring 2.5.x and AspectJ compile time weaving. This is a short post, so I'll assume you have a working knowledge of Spring, it's transaction management capabilities, and Aspect J.

There are a number of ways to configure transaction managment in Spring for a complete description of the vast number of options available to you, I suggest you persue the Spring documenation. In this post, I'm dealing with the scenario in which you want declare your transaction semantics directly in your code using the @Transactional annotation, and in which you want to utilize AspectJ's compile time weaving rather than interface proxies or load time weaving.

<target name="-post-compile"> <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">             <classpath>                 <pathelement location="${lib.dir}/AspectJ_1.6.8/aspectjtools.jar"/>             </classpath> </taskdef>  <iajc aspectPath="${file.reference.spring-aspects.jar}; ${build.classes.dir}/gov/ic/dia/wiseism/webservices/aspects"             classpath="${lib.dir}/AspectJ_1.6.8/aspectjrt.jar; ${javac.classpath}"             inpath="${build.classes.dir}"             destDir="${build.classes.dir}"             showWeaveInfo="true" /> <targe>

Posted via web from Relatively Prime

No comments:

Post a Comment