Adapt to upstream Spring Framework changes

This commit is contained in:
Phillip Webb
2022-08-25 12:12:42 -07:00
parent 41c1d9f5c9
commit 973e23dc5e

View File

@@ -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);