异常报错: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();

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部