feat:兼容webflux的日志切面

This commit is contained in:
wangyu 2021-12-07 19:53:33 +08:00
parent defcf09d91
commit 23b89d8c56

View File

@ -65,15 +65,9 @@ public class LogAdvice {
if (null != result) { if (null != result) {
// 判断结果是否是publisher // 判断结果是否是publisher
if (result instanceof Mono) { if (result instanceof Mono) {
((Mono<?>) result).subscribe(data -> { ((Mono<?>) result).subscribe(context::setResult, context::setError, context::end);
context.setResult(data);
context.end();
});
} else if (result instanceof Flux) { } else if (result instanceof Flux) {
((Flux<?>) result).collectList().subscribe(list -> { ((Flux<?>) result).collectList().subscribe(context::setResult, context::setError, context::end);
context.setResult(list);
context.end();
});
} else { } else {
context.setResult(result); context.setResult(result);
context.end(); context.end();