Spring RequestContextHolder and WebTestClient
问题 I'm using Spring RequestContextHolder in the controller and it works fine. But in the unit test I get java.lang.IllegalStateException using WebTestClient . Here is an example: package demo.reactive.controller; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.RequestContextHolder; import reactor.core.publisher.Mono;