In Spring webflux tests I was having this timeout out issue and I wanted to increase timeout in the webclient

Exception

java.lang.IllegalStateException: Timeout on blocking read for 5000 MILLISECONDS

	at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:123)
	at reactor.core.publisher.Mono.block(Mono.java:1687)
	at org.springframework.test.web.reactive.server.DefaultWebTestClient$DefaultRequestBodyUriSpec.exchange(DefaultWebTestClient.java:307)

Solution

By default, the WebTestClient will be timeout after 5 seconds. But we can modify this time out using

@AutoConfigureWebTestClient(timeout = "10000")