在stackoverflow中有这样一句话: The reflection layer wraps any exception in an InvocationTargetException
, which lets you tell the difference between an exception actually caused by a failure in the reflection call (maybe your argument list wasn't valid, for example) and a failure within the method called
翻译一下就是: 反射层将所有的异常都包装在一个InvocationTargetException 中,能使你区分异常的实际上是反射层的引起的一个调用失败(例如参数列表无效)和调用方法内部的错误(可能数据库没有对应数据)。