Spring
⏰ WebTestClient Timeout
김효재
2020. 3. 20. 15:02
WebTestClient를 사용했을 때, timeout 관련 예외가 발생했다. 아무래도 외부 API와 Connection 때문에 생긴 문제라고 생각이 든다.
java.lang.IllegalStateException: Timeout on blocking read for 5000 MILLISECONDS
...
기본적으로 WebTestClient는 timeout이 5000 (5초)를 기본값으로 가진다. 계속해서 timeout 관련 예외가 발생한다면 아래와 같이 해결 할 수 있었다.
@AutoConfigureWebTestClient(timeout = "10000") // 10 seconds
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureWebTestClient(timeout = "10000") //10 seconds
public class CommonTest {
@Autowired
private WebTestClient webClient;
...