Now AspectJ 5 has been announced, it seems to me a bit of a no-brainer for Spring to have full on support for the more advanced point-cuts of AspectJ/AspectWerkz.
There has been various integration in the past, and I am sure there will be more in the future.
To start with, Alex (of AspectWerkz/AspectJ 5) has written a new AspectWerkzPointcutAdvisor.
So, take a look at before:
<bean id="theMethodExecutionGetTargetAndArgsAroundAdvisor1" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor"> <property name="advice"> <ref local="theMethodExecutionGetTargetAndArgsAroundAdvice"/> </property> <property name="pattern"> <value>.*aroundStackedWithArgAndTarget.*</value> </property> </bean>
and now see how you can use the expressive pointcuts:
<bean id="theMethodExecutionAfterThrowingAdvisor" class="awbench.spring.AspectWerkzPointcutAdvisor"> <property name="advice"> <ref local="theMethodExecutionAfterThrowingAdvice"/> </property> <property name="expression"> <value>execution(* *..*.afterThrowingRTE(..))</value> </property> </bean>
In fact, my guess is that, as time goes on and more people get into the power of AOP… the standard Spring AOP will be displaced by the more powerful Spring-AspectJ style.
However, Spring AOP has its uses, and it is great that you can chop and change so easily with Spring!