Spring ThrowsAdvice使用例子
ThrowsAdvice用于拦截异常 [code="java"] import java.lang.reflect.Method; import org.springframework.aop.ThrowsAdvice; public class DaoThrowsAdvice implements ThrowsAdvice { public void afterThrowing(Method m, Object args, Object target, Throwable subclass) { System.out.println("[DaoThrowsAdvice]: An exception occur: " + subclass.getClass().getSimpleName()); System.exit(0); } } [/code] 配置文件 [code="java"] beforeDaoAdvice afterDaoAdvice throwsDaoAdvice aroundAdvice [/code] 完整程序代码请参考附件。