Spring3.1异常通知ThrowsAdvice说明
引言:
笔者直接从Spring2.x跳到Spring3.1,在用到org.springframework.aop.ThrowsAdvice时,发现ThrowsAdvice接口内部已经被清空,立即迷茫了。怎么个说法?
正文:
遇到这样的问题,啥也别说,先找Spring3.1的官方文档瞅瞅看有没说明(要没的话3.0继续找)……
两分钟后,找到下面一段说明:
Throws adviceThrows advice is invoked after the return of the join point if the join point threw an exception. Springofferstypedthrowsadvice.Notethatthismeansthattheorg.springframework.aop.ThrowsAdvice interface does not contain any methods: It is a taginterface identifying that the given object implements one or more typed throws advice methods. Theseshould be in the form of: afterThrowing([Method, args, target], subclassOfThrowable)Only the last argument is required. The method signatures may have either one or four arguments,depending on whether the advice method is interested in the method and arguments. ...