From 973e23dc5e4c6745a5d846b22db0732506e3890b Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 25 Aug 2022 12:12:42 -0700 Subject: [PATCH] Adapt to upstream Spring Framework changes --- .../boot/web/reactive/result/view/MustacheView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheView.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheView.java index cdd0b26770..da001b6dba 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheView.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheView.java @@ -34,6 +34,7 @@ import reactor.core.publisher.Mono; import org.springframework.core.io.Resource; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.core.io.buffer.DefaultDataBufferFactory; import org.springframework.http.MediaType; import org.springframework.web.reactive.result.view.AbstractUrlBasedView; import org.springframework.web.reactive.result.view.View; @@ -81,7 +82,8 @@ public class MustacheView extends AbstractUrlBasedView { return Mono .error(new IllegalStateException("Could not find Mustache template with URL [" + getUrl() + "]")); } - DataBuffer dataBuffer = exchange.getResponse().bufferFactory().allocateBuffer(); + DataBuffer dataBuffer = exchange.getResponse().bufferFactory() + .allocateBuffer(DefaultDataBufferFactory.DEFAULT_INITIAL_CAPACITY); try (Reader reader = getReader(resource)) { Template template = this.compiler.compile(reader); Charset charset = getCharset(contentType).orElseGet(this::getDefaultCharset);