|
43 | 43 | import com.fasterxml.jackson.databind.ObjectMapper; |
44 | 44 | import com.fasterxml.jackson.databind.cfg.MapperConfig; |
45 | 45 | import com.fasterxml.jackson.databind.deser.std.StdDeserializer; |
| 46 | +import com.fasterxml.jackson.databind.json.JsonMapper; |
46 | 47 | import com.fasterxml.jackson.databind.jsontype.BasicPolymorphicTypeValidator; |
47 | 48 | import com.fasterxml.jackson.databind.jsontype.NamedType; |
48 | 49 | import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator; |
@@ -114,12 +115,13 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex |
114 | 115 | * default set of trusted classes. |
115 | 116 | */ |
116 | 117 | public Jackson2ExecutionContextStringSerializer(String... trustedClassNames) { |
117 | | - this.objectMapper = new ObjectMapper(); |
118 | | - this.objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false); |
119 | | - this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); |
120 | | - this.objectMapper.configure(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES, true); |
121 | | - this.objectMapper.setDefaultTyping(createTrustedDefaultTyping(trustedClassNames)); |
122 | | - this.objectMapper.registerModule(new JobParametersModule()); |
| 118 | + this.objectMapper = JsonMapper.builder() |
| 119 | + .configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false) |
| 120 | + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) |
| 121 | + .configure(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES, true) |
| 122 | + .setDefaultTyping(createTrustedDefaultTyping(trustedClassNames)) |
| 123 | + .addModule(new JobParametersModule()) |
| 124 | + .build(); |
123 | 125 | } |
124 | 126 |
|
125 | 127 | public void setObjectMapper(ObjectMapper objectMapper) { |
|
0 commit comments