Подскажите пожалуйста,
пытаюсь настроить spring webClient'a
задал проперти
spring.codec.max-in-memory-size=10MB
в коде настраиваю webclient'a
HttpClient httpClient = HttpClient.create()
.tcpConfiguration(client ->
client.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 6000)
.doOnConnected(conn -> conn
.addHandlerLast(new ReadTimeoutHandler(10))
.addHandlerLast(new WriteTimeoutHandler(10))));
ClientHttpConnector connector = new ReactorClientHttpConnector(httpClient);
this.webClient = WebClient.builder()
.clientConnector(connector)
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.build();
далее пытаюсь получить картинку из инета
result = webClient
.get()
.uri(urlLink)
.header("X-Requested-With", "XMLHttpRequest")
.exchange()
.flatMap(response -> {
if (!response.statusCode().is2xxSuccessful()) {
return Mono.error(new RuntimeException("Internal server error"));
} else {
return response.bodyToMono(ByteArrayResource.class);
}
}).map(ByteArrayResource::getByteArray)
.block();
} catch (Exception e) {
log.info("can't take image", e);
}
почему то все равно падает c ошибкой с упиранием в размер 256kb
org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144