【发布时间】:2021-12-21 09:17:45
【问题描述】:
我正在使用 WebFlux,我想使用 AOP 登录如下:
Class LogAop {
@AfterReturning("execution ...")
public void configSetted() {
// Getting username by token
Mono<Sting> username = ReactiveSecurityContextHolder.getContext()
.map { ... };
username.subscribe ({it -> loggerin.info(it);});
}
}
在上面的代码中,我想记录用户名,但是没有记录。如何订阅Mono或Flux而不返回方法?
注意:有时我想对订阅数据做不同的事情,例如将数据保存在 db 中。
【问题讨论】:
标签: java spring-boot spring-webflux webflux