Java编程Throwable与Exception

Java编程Throwable与Exception


Throwable
其实是Exception的父类。关系瞬间明确。

哪里可以见到神龙见首不见尾的Throwable呢?

一般来说切面编程的环绕通知会有的,例如:

import org.springframework.stereotype.Component;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Around;

@Component
@Aspect
public class TestAspect{

	@Around(value = "execution(* com.test.controller.*Controller.*(..))")
	public Object aroundMethod(ProceedingJoinPoint joinpoint)throws Throwable{
		Object result=null;
		try{
			result = joinpoint.proceed();
		}catch(Throwable e){
			throw e;
		}
	}


}
Java编程Throwable与Exception

相关文章:

你感兴趣的文章:

标签云: