Spring 中 Around AOP 实现了 ThrowsAdvice 接口后,为什么必须写一个方法名是 afterThrowing 的方法?
不然会报错:
At least one handler method must be found in class
,既然如此,这个方法为什么不在接口里定义呢?
熟悉Spring的人讲讲。
[code="java"]
package hello;
import org.springframework.aop.ThrowsAdvice;
public class LoggingThrowsAdvice implements ThrowsAdvice{
public void afterThrowing(Exception ex) throws Throwable{
LogUtil.log.debug("shen he shu ju you yi chang...");
}
}
[/code]