@AfterThrowing

@AfterThrowing(throwing="ex", pointcut="within(com.xms.controller.*)")

public void four(Exception ex){
System.out.println("four");
ex.printStackTrace();//打印异常信息
StackTraceElement []elements=ex.getStackTrace();
//记录异常信息
System.out.println("-->"+elements[0].toString());
}

 

参考:https://blog.csdn.net/owen_william/article/details/50812780

posted @ 2018-07-13 16:36  阴翳公子  阅读(1018)  评论(0编辑  收藏  举报