Jackson decoder supports array/Collection elements

Closes gh-32579
This commit is contained in:
rstoyanchev
2024-04-17 15:39:04 +01:00
parent 00c7002354
commit 0bc447c304
2 changed files with 23 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.http.codec.json;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
@@ -135,9 +136,12 @@ public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport imple
forceUseOfBigDecimal = true;
}
boolean tokenizeArrays = (!elementType.isArray() &&
!Collection.class.isAssignableFrom(elementType.resolve(Object.class)));
Flux<DataBuffer> processed = processInput(input, elementType, mimeType, hints);
Flux<TokenBuffer> tokens = Jackson2Tokenizer.tokenize(processed, mapper.getFactory(), mapper,
true, forceUseOfBigDecimal, getMaxInMemorySize());
tokenizeArrays, forceUseOfBigDecimal, getMaxInMemorySize());
return Flux.deferContextual(contextView -> {