@Before
を使用する代わりに、ソースの場所を取得するため@Around
に使用できるを使用する必要があります。ProceedingJoinPoint
@Around(" ..... ")
public void test(ProceedingJoinPoint pjp) throws Throwable {
SourceLocation sl = pjp.getSourceLocation();
System.out.println(sl.getFileName());
System.out.println(sl.getLine());
System.out.println(sl.getWithinType());
// allow through
pjp.proceed();
}
call
あなたの場合、代わりに必要かもしれないように聞こえますが、Spring AOPではサポートされていないexecution
ようcall
です:-
その他のポイントカットタイプ
完全なAspectJポイントカット言語は、Springではサポートされていない追加のポイントカット指定子をサポートします。これらは、call、initialization、preinitialization、staticinitialization、get、set、handler、adviceexecution、withincode、cflow、cflowbelow、if、@ this、および@withincodeです。Spring AOPによって解釈されるポイントカット式でこれらのポイントカット指定子を使用すると、IllegalArgumentExceptionがスローされます。