aop日志记录 It is illegal to call this method if the current request is not in asynchronou

2022-06-09 15:14:01 浏览数 (1)

废话不多说,一针见血,狠不狠你说了算!!

代码语言:javascript复制
public static Object filterParams(Object object){
    if(object instanceof HttpServletRequest){
        object = "请求格式为Request类型,实例化失败,已经转换为字符串:(" object.toString() ")";
    }
    if(object instanceof HttpServletResponse){
        object = "请求格式为Response类型,实例化失败,已经转换为字符串:(" object.toString() ")";
    }
    if(object instanceof MultipartFile || object instanceof MultipartFile[]){
        object = "请求格式为文件流类型,实例化失败,已经转换为字符串:(" object.toString() ")";
    }
    return object;
}

剩下的加上去就行了,大家可以自行扩展。

0 人点赞