异常报错:org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
解决方案:
WebClient webClient = WebClient.builder().exchangeStrategies(ExchangeStrategies.builder().codecs(clientCodecConfigurer -> clientCodecConfigurer.defaultCodecs()//这里设置内存大小即可.maxInMemorySize(10 * 1024 * 1024)).build()).build();
Mono<T> mono = webClient.get().uri(url).header("Content-Type", "application/json").retrieve().bodyToMono(tClass);
T t = mono.block();