Spring學習心得(三)
在Around advice 的invoke方法中,對象MethodInvocation很重要,getArgument()方法可以得到攔截調用方法的參數,如:methodinvocation.getArgument()[]isAssignableForm可以對兩個Class進行比較,比如:XXX.class.isAssignableFrom(methodinvocation.getMethod().getDeclaringClass())
在Before advice的public void before(Method m, Object[] args, Object target) throws Throwable {}中可以用以下方法進行比較:target instanceof XXX
posted on 2007-09-04 17:27 劉錚 閱讀(169) 評論(0) 編輯 收藏 所屬分類: Spring