【错误配置文件】
<aop:config> <aop:pointcut expression="execution(* net.fifteenho.service.impl.UserServiceImpl.*(..))" id="mypc"/> <aop:advisor advice-ref="tx" pointcut-ref="mypc"/> <aop:aspect ref="myException"> <aop:after-throwing method="exception" pointcut-ref="mypc"/><!--缺少throwing属性赋值--> </aop:aspect> </aop:config>
【正确配置文件】
<aop:config> <aop:pointcut expression="execution(* net.fifteenho.service.impl.UserServiceImpl.*(..))" id="mypc"/> <aop:advisor advice-ref="tx" pointcut-ref="mypc"/> <aop:aspect ref="myException"> <aop:after-throwing method="exception" throwing="e" pointcut-ref="mypc"/><!--throwing属性值必须与此切面类的exception方法的参数名称一致--> </aop:aspect> </aop:config>