Programming/Spring

[Spring] SpringBoot WebClient buffer size 설정

OriginMaster 2021. 11. 18. 11:17
반응형

API Rest 테스트를 하던 도중 특정 주소로부터 데이터를 가져오다가 이런 에러가 발생하였다.

 

대충 읽어보니 limit buffer 값이 초과해서 발생한 에러인데.

Spring core 5.3.12 기준으로 buffer의 기준 크기는 256KB 이다.

 

따라서 buffer size만 변경해주면 문제는 해결된다.

 

방법1) application.properties 에 해당값을 추가해준다. (임의로 10MB만 할당)
spring.codec.max-in-memory-size=10MB

 

 

방법2) ExchangeStrategies 인터페이스 사용

..

ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
				.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(-1)).build(); // -1은 unlimit

this.webClient = webClientBuilder
	.exchangeStrategies(exchangeStrategies)
	.baseUrl("API URL").build();
                
                
..

 

 

https://stackoverflow.com/questions/59326351/configure-spring-codec-max-in-memory-size-when-using-reactiveelasticsearchclient

 

configure spring.codec.max-in-memory-size When using ReactiveElasticsearchClient

I am using the ReactiveElasticsearchClient from spring-data-elasticsearch 3.2.3 with spring-boot 2.2.0. When upgrading to spring-boot 2.2.2 i have got org.springframework.core.io.buffer.

stackoverflow.com

https://stackoverflow.com/questions/59735951/databufferlimitexception-exceeded-limit-on-max-bytes-to-buffer-webflux-error

 

DataBufferLimitException: Exceeded limit on max bytes to buffer webflux error

While sending a file I receive an array of bytes. I always have a problem with webflux to receive an array. the error thrown as below : org.springframework.core.io.buffer.DataBufferLimitException:

stackoverflow.com

 

반응형