spring aop问题
- 在环绕通知中使用try_catch不会触发after-throwing通知,并且流程不会受到影响,程序会继续执行。
- 使用throws就会触发after-throwing,会执行after-throwing绑定的逻辑代码,之后会执行after通知(如果有),然后结束程序。
<aop:config>
<aop:pointcut id="usullyPointcut" expression="execution(public * name.yu.springaop.target.impl.TargetInterfaceImpl.method())"/>
<aop:aspect ref="myAspect">
<aop:before method="before" pointcut-ref="usullyPointcut"/>
<aop:after-returning method="afterReturning" pointcut-ref="usullyPointcut"/>
<aop:after-throwing method="throwing" pointcut-ref="usullyPointcut"/>
<aop:after method="after" pointcut-ref="usullyPointcut"/>
</aop:aspect>
</aop:config>