mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:30:28 +00:00
Revert "Use JsonMapper instead of ObjectMapper when relevant"
This reverts commit d115f36400.
See gh-35282
This commit is contained in:
+9
-8
@@ -20,6 +20,7 @@ import java.io.InputStream;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import tools.jackson.core.io.JsonStringEncoder;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
import tools.jackson.databind.cfg.MapperBuilder;
|
||||
import tools.jackson.databind.json.JsonMapper;
|
||||
|
||||
@@ -36,7 +37,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class JacksonJsonSockJsMessageCodec extends AbstractSockJsMessageCodec {
|
||||
|
||||
private final JsonMapper jsonMapper;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -45,28 +46,28 @@ public class JacksonJsonSockJsMessageCodec extends AbstractSockJsMessageCodec {
|
||||
* {@link MapperBuilder#findModules(ClassLoader)}.
|
||||
*/
|
||||
public JacksonJsonSockJsMessageCodec() {
|
||||
this.jsonMapper = JsonMapper.builder().findAndAddModules(JacksonJsonSockJsMessageCodec.class.getClassLoader()).build();
|
||||
this.objectMapper = JsonMapper.builder().findAndAddModules(JacksonJsonSockJsMessageCodec.class.getClassLoader()).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new instance with the provided {@link JsonMapper}.
|
||||
* Construct a new instance with the provided {@link ObjectMapper}.
|
||||
* @see JsonMapper#builder()
|
||||
* @see MapperBuilder#findAndAddModules(ClassLoader)
|
||||
*/
|
||||
public JacksonJsonSockJsMessageCodec(JsonMapper jsonMapper) {
|
||||
Assert.notNull(jsonMapper, "JsonMapper must not be null");
|
||||
this.jsonMapper = jsonMapper;
|
||||
public JacksonJsonSockJsMessageCodec(ObjectMapper objectMapper) {
|
||||
Assert.notNull(objectMapper, "ObjectMapper must not be null");
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String @Nullable [] decode(String content) {
|
||||
return this.jsonMapper.readValue(content, String[].class);
|
||||
return this.objectMapper.readValue(content, String[].class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String @Nullable [] decodeInputStream(InputStream content) {
|
||||
return this.jsonMapper.readValue(content, String[].class);
|
||||
return this.objectMapper.readValue(content, String[].class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user