今天使用WebClient 请求接口 出现了
org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
at org.springframework.core.io.buffer.LimitedDataBufferList.raiseLimitException(LimitedDataBufferList.java:101)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
缓冲区不足,查了好多解决办法 说是通过配置
spring.codec.max-in-memory-size 属性来配置缓冲区大小
但是新增配置后不生效依然出现该错误
经过资料查找 解决办法如小 修改WebClient 请求缓冲区大小为 10MB:
WebClient.builder().exchangeStrategies(ExchangeStrategies.builder()
.codecs(configurer -> configurer
.defaultCodecs()
.maxInMemorySize(10 * 1024 * 1024))
.build())
.build()....
解决缓冲区不足的问题