org.springframework.core.io.buffer.DataBufferLimitException:* Exceeded limit on max bytes to buffer : 262144 springboot
请求体大小超出256k
下面是webflux springboot3.0 的解决办法
@Configuration
public class WebFLuxConfig implements WebFluxConfigurer {
/**
* 默认是256k,如果请求体太大会报
* (org.springframework.core.io.buffer.DataBufferLimitException:
* Exceeded limit on max bytes to buffer : 262144 springboot)
* <p/>
* 设置为-1,则不显示请求大小,我这里设置为512MB,够用
* <p/>
* 配置HTTP消息编解码器,设置最大内存大小为 512MB
*
* @param configurer 用于配置HTTP消息编解码器的ServerCodecConfigurer对象
*/
@Override
public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
configurer.defaultCodecs().maxInMemorySize(512 * 1024 * 1024);
}
}
文章介绍了在SpringBoot3.0中,如何处理WebFlux请求体过大导致的`DataBufferLimitException`,通过重置`ServerCodecConfigurer`的默认HTTP消息编解码器,将最大内存大小设置为512MB以适应大请求体。
3万+

被折叠的 条评论
为什么被折叠?



