i implement WebFilter in my project and put an item in exchange.getAttributes() like this:
@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
Map<String, Object> attributes = exchange.getAttributes();
attributes.put("Request-Id", requestInfo.getId());
}
i want to get "request-id" value in an aspect class that annotate with @Around like this:
@Around("@annotation(annotationName)")
public Object around(ProceedingJoinPoint point) throws Throwable {
}
I tried adding "args" like this but then, when calling the method marked with the "annotationName", the @Around class is no longer called. so it seems that @Around stopped working after I changed it
@Around("@annotation(annotationName) && args(exchange,..)"")
public Object around(ProceedingJoinPoint point, ServerWebExchange exchange) throws Throwable {
Map<String, Object> attributes = exchange.getAttributes();
String requestId = attributes.get("Request-Id");
}