webtestclient

Spring RequestContextHolder and WebTestClient

寵の児 提交于 2020-12-04 09:25:17
问题 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;

Spring RequestContextHolder and WebTestClient

我的未来我决定 提交于 2020-12-04 09:18:40
问题 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;

Spring RequestContextHolder and WebTestClient

[亡魂溺海] 提交于 2020-12-04 09:18:23
问题 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;