I have an existing spring-mvc
application with different @RestController
. Now I want to add a Mono<String>
endpoint, and log the request timestamp with url path, as well as the response timestamp.
But how? I cannot simply @EnableWebFlux
as I would have to disable spring-mvc therefor.
How could I register a filter explicit for the webflux endpoint that catches on invocation, and right before the response is written back async?
@RestController
public class FluxService {
@PostMapping
public Mono<String> post() {
return webClient.post().uri(uri).bodyValue(payload).retrieve().bodyToMono(String.class);
}
}
I want enhanced logging on the @PostMapping
endpoint, not on the webClient
!