欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2024-02-12 11:19:40
...

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转换。

相关标签: java开发相关