首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >DataBufferLimitException:超出缓冲webflux错误的最大字节数限制

DataBufferLimitException:超出缓冲webflux错误的最大字节数限制
EN

Stack Overflow用户
提问于 2020-01-14 22:38:14
回答 9查看 45.1K关注 0票数 51

在发送文件时,我收到一个字节数组。我总是在webflux接收数组时遇到问题。抛出的错误如下:

代码语言:javascript
运行
复制
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

你现在如何在webflux中解决这个问题?

EN

回答 9

Stack Overflow用户

发布于 2020-06-24 04:29:57

这个工作台很适合我

  1. 在某个配置类或主Springbootapplication类中创建bean

@Bean public WebClient getWebClientBuilder(){ return WebClient.builder().exchangeStrategies(ExchangeStrategies.builder() .codecs(configurer -> configurer .defaultCodecs() .maxInMemorySize(16 * 1024 * 1024)) .build()) .build();}

  1. 下一步,转到要使用the客户端的所需类

@RestController / @Bean/ @服务公共类PaySharpGatewayController { @Autowired webClient;public void test(){ String out = webClient .get() .uri(“API的端点”) .retrieve() .bodyToMono(String.class) .block();sysout(out) }

票数 70
EN

Stack Overflow用户

发布于 2020-02-21 22:01:43

我想这个问题是关于在Spring Boot中添加一个新的spring.codec.max- in -memory-size配置属性。将其添加到属性中,如:

代码语言:javascript
运行
复制
spring:
  codec:
    max-in-memory-size: 10MB
票数 40
EN

Stack Overflow用户

发布于 2020-02-25 05:50:49

spring boot配置文件中设置maximum bytes (以 in 为单位),如下所示:

代码语言:javascript
运行
复制
spring.codec.max-in-memory-size=20MB
票数 15
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59735951

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档