Skip to content

Commit 9944e2a

Browse files
committed
Polishing.
Adopt documentation to Jackson 3. See #2488
1 parent a375e1d commit 9944e2a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/antora/modules/ROOT/pages/representations.adoc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ public class MyEntity {
3030

3131
In a default configuration, Jackson has no idea what class to instantiate when POSTing new data to the exporter. This is something you need to tell Jackson either through an annotation, or (more cleanly) by registering a type mapping by using a `Module`.
3232

33-
To add your own Jackson configuration to the `ObjectMapper` used by Spring Data REST, override the `configureJacksonObjectMapper` method. That method is passed an `ObjectMapper` instance that has a special module to handle serializing and deserializing `PersistentEntity` objects. You can register your own modules as well, as the following example shows:
33+
To add your own Jackson configuration to the `ObjectMapper` used by Spring Data REST, override the `configureJacksonObjectMapper` method.
34+
That method is passed an `MapperBuilder` instance that has a special module to handle serializing and deserializing `PersistentEntity` objects.
35+
You can register your own modules as well, as the following example shows:
3436

3537
====
3638
[source,java]
3739
----
3840
@Override
39-
protected void configureJacksonObjectMapper(ObjectMapper objectMapper) {
41+
public void configureJacksonObjectMapper(MapperBuilder<? extends ObjectMapper, ? extends MapperBuilder<?, ?>> mapperBuilder) {
4042
41-
objectMapper.registerModule(new SimpleModule("MyCustomModule") {
43+
mapperBuilder.addModule(new SimpleModule("MyCustomModule") {
4244
4345
@Override
4446
public void setupModule(SetupContext context) {
@@ -51,7 +53,8 @@ protected void configureJacksonObjectMapper(ObjectMapper objectMapper) {
5153
----
5254
====
5355

54-
Once you have access to the `SetupContext` object in your `Module`, you can do all sorts of cool things to configure Jackson's JSON mapping. You can read more about how `Module` instances work on https://wiki.fasterxml.com/JacksonFeatureModules[Jackson's wiki].
56+
Once you have access to the `SetupContext` object in your `Module`, you can do all sorts of cool things to configure Jackson's JSON mapping.
57+
You can read more about how `Module` instances work on https://github.com/FasterXML/jackson-databind/wiki/JacksonFeatures[Jackson's wiki].
5558

5659
[[representations.serializers-and-deserializers.serializers]]
5760
=== Adding Custom Serializers for Domain Types

0 commit comments

Comments
 (0)