[]
AOP and Java 5 annotations with AspectWerkz
[ avasseur ] 10:35, Friday, 3 December 2004

Our tutorial on AspectWerkz 2.x has been published on The Server Side.

In this tutorial, we are implementing a subset of the EJB 3 declarative transactions specification using AspectWerkz.

The aspect is written in plain Java with Java 5 annotations, and the sample application is running outside of any application server by using of ObjectWeb JOTM and we provide an easy way to use any JTA transaction manager.

@Aspect("perJVM")
public abstract class TransactionAttributeAwareTransactionProtocol {

    @Expression("execution(@javax.ejb.TransactionAttribute * *.*(..))")
    Pointcut transactedMethods;

    /**
     * Before advice that will initiate transaction management is bounded
	 		to the transactedMethods pointcut
     */
    @Before("transactedMethods")
    public void enterTransactedMethod(...) throws Throwable {
        ...
    }
}

To run the application, we are using Java 5 JVMTI ie you simply compile your applications and aspects with plain javac and run it with plain java.

Read more and practice.
Discuss the tutorial


Comments
Post a comment









Remember personal info?