mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-23 06:29:10 +00:00
Revert "Use JsonMapper instead of ObjectMapper when relevant"
This reverts commit d115f36400.
See gh-35282
This commit is contained in:
+5
-4
@@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
import tools.jackson.databind.cfg.MapperBuilder;
|
||||
import tools.jackson.databind.json.JsonMapper;
|
||||
|
||||
@@ -72,20 +73,20 @@ public class JacksonJsonDecoder extends AbstractJacksonDecoder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new instance with the provided {@link JsonMapper}.
|
||||
* Construct a new instance with the provided {@link ObjectMapper}.
|
||||
* @see JsonMapper#builder()
|
||||
* @see MapperBuilder#findModules(ClassLoader)
|
||||
*/
|
||||
public JacksonJsonDecoder(JsonMapper mapper) {
|
||||
public JacksonJsonDecoder(ObjectMapper mapper) {
|
||||
this(mapper, DEFAULT_JSON_MIME_TYPES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new instance with the provided {@link JsonMapper} and {@link MimeType}s.
|
||||
* Construct a new instance with the provided {@link ObjectMapper} and {@link MimeType}s.
|
||||
* @see JsonMapper#builder()
|
||||
* @see MapperBuilder#findModules(ClassLoader)
|
||||
*/
|
||||
public JacksonJsonDecoder(JsonMapper mapper, MimeType... mimeTypes) {
|
||||
public JacksonJsonDecoder(ObjectMapper mapper, MimeType... mimeTypes) {
|
||||
super(mapper, mimeTypes);
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -25,6 +25,7 @@ import reactor.core.publisher.Flux;
|
||||
import tools.jackson.core.PrettyPrinter;
|
||||
import tools.jackson.core.util.DefaultIndenter;
|
||||
import tools.jackson.core.util.DefaultPrettyPrinter;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
import tools.jackson.databind.ObjectWriter;
|
||||
import tools.jackson.databind.SerializationFeature;
|
||||
import tools.jackson.databind.cfg.MapperBuilder;
|
||||
@@ -79,21 +80,21 @@ public class JacksonJsonEncoder extends AbstractJacksonEncoder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new instance with the provided {@link JsonMapper}.
|
||||
* Construct a new instance with the provided {@link ObjectMapper}.
|
||||
* @see JsonMapper#builder()
|
||||
* @see MapperBuilder#findModules(ClassLoader)
|
||||
*/
|
||||
public JacksonJsonEncoder(JsonMapper mapper) {
|
||||
public JacksonJsonEncoder(ObjectMapper mapper) {
|
||||
this(mapper, DEFAULT_JSON_MIME_TYPES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new instance with the provided {@link JsonMapper} and
|
||||
* Construct a new instance with the provided {@link ObjectMapper} and
|
||||
* {@link MimeType}s.
|
||||
* @see JsonMapper#builder()
|
||||
* @see MapperBuilder#findModules(ClassLoader)
|
||||
*/
|
||||
public JacksonJsonEncoder(JsonMapper mapper, MimeType... mimeTypes) {
|
||||
public JacksonJsonEncoder(ObjectMapper mapper, MimeType... mimeTypes) {
|
||||
super(mapper, mimeTypes);
|
||||
setStreamingMediaTypes(List.of(MediaType.APPLICATION_NDJSON));
|
||||
this.ssePrettyPrinter = initSsePrettyPrinter();
|
||||
|
||||
+4
-3
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import tools.jackson.core.JsonGenerator;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
import tools.jackson.databind.cfg.MapperBuilder;
|
||||
import tools.jackson.databind.json.JsonMapper;
|
||||
|
||||
@@ -31,7 +32,7 @@ import org.springframework.http.converter.AbstractJacksonHttpMessageConverter;
|
||||
/**
|
||||
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter}
|
||||
* that can read and write JSON using <a href="https://github.com/FasterXML/jackson">Jackson 3.x's</a>
|
||||
* {@link JsonMapper}.
|
||||
* {@link ObjectMapper}.
|
||||
*
|
||||
* <p>This converter can be used to bind to typed beans, or untyped
|
||||
* {@code HashMap} instances.
|
||||
@@ -78,11 +79,11 @@ public class JacksonJsonHttpMessageConverter extends AbstractJacksonHttpMessageC
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new instance with the provided {@link JsonMapper}.
|
||||
* Construct a new instance with the provided {@link ObjectMapper}.
|
||||
* @see JsonMapper#builder()
|
||||
* @see MapperBuilder#findModules(ClassLoader)
|
||||
*/
|
||||
public JacksonJsonHttpMessageConverter(JsonMapper objectMapper) {
|
||||
public JacksonJsonHttpMessageConverter(ObjectMapper objectMapper) {
|
||||
super(objectMapper, DEFAULT_JSON_MIME_TYPES);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user