close

[Solved] DataBufferLimitException: Exceeded limit on max bytes to buffer webflux error

Hello Guys, How are you all? Hope You all Are Fine. Today I am facing the following error DataBufferLimitException: Exceeded limit on max bytes to buffer webflux error in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How DataBufferLimitException: Exceeded limit on max bytes to buffer webflux Error Occurs?

Today I am facing the following error DataBufferLimitException: Exceeded limit on max bytes to buffer webflux error in Java.

How To Solve DataBufferLimitException: Exceeded limit on max bytes to buffer webflux Error ?

  1. How To Solve DataBufferLimitException: Exceeded limit on max bytes to buffer webflux Error ?

    To Solve DataBufferLimitException: Exceeded limit on max bytes to buffer webflux Error I suppose this issue is about adding a new spring.codec.max-in-memory-size configuration property in Spring Boot.

  2. DataBufferLimitException: Exceeded limit on max bytes to buffer webflux error

    To Solve DataBufferLimitException: Exceeded limit on max bytes to buffer webflux Error I suppose this issue is about adding a new spring.codec.max-in-memory-size configuration property in Spring Boot.

Solution 1

This workerd for me

  1. Create a bean in your one of the configuration class or the main Springbootapplication class@Bean public WebClient getWebClientBuilder(){ return WebClient.builder().exchangeStrategies(ExchangeStrategies.builder() .codecs(configurer -> configurer .defaultCodecs() .maxInMemorySize(16 * 1024 * 1024)) .build()) .build(); }
  2. Next go to your desired class where you want to use the webclient @RestController / @Bean/ @Service public class PaySharpGatewayController { @Autowired WebClient webClient; public void test(){ String out = webClient .get() .uri("end point of an API") .retrieve() .bodyToMono(String.class) .block(); sysout(out) }

Solution 2

I suppose this issue is about adding a new spring.codec.max-in-memory-size configuration property in Spring Boot. Add it to the properties like:

spring:
  codec:
    max-in-memory-size: 10MB

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read