1. 程式人生 > >It is illegal to call this method if the current request is not in asynchronous mode

It is illegal to call this method if the current request is not in asynchronous mode

nested exception is java.lang.IllegalStateException: It is illegal to call this method if the current request is not in asynchronous mode (i.e. isAsyncStarted() returns false)] with root cause

MethodSignature methodSignature = ((MethodSignature) joinPoint.getSignature());
String methodName = methodSignature.getName();
String className = methodSignature.getDeclaringTypeName();
Object[] args = joinPoint.getArgs();

    String argwStr = JSON.toJSONString(args);

當使用切面時,如果使用args中包含了,request物件會到導致程式丟擲throwable異常資訊,所以加切面時建議將args陣列中的內容進行移除。或者不要直接將前臺的請求進行攔截後進行json轉換。