Revert "Use JsonMapper instead of ObjectMapper when relevant"

This reverts commit d115f36400.

See gh-35282
This commit is contained in:
Sébastien Deleuze
2025-08-12 15:21:20 +02:00
parent 49b28be1be
commit 0389e3e3af
17 changed files with 105 additions and 94 deletions
@@ -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);
}
@@ -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();
@@ -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);
}