Fix object mapper customization in Jackson2ExecutionContextStringSerializer

This commit fixes the setter of object mapper to copy the configuration
of the custom object mapper provided by the user and "augment" it with
the JobParametersModule.

Resolves BATCH-2828
This commit is contained in:
Mahmoud Ben Hassine
2019-09-04 12:52:28 +02:00
parent 5be1c9af94
commit a15a6bfad8

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2018 the original author or authors.
* Copyright 2008-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,7 +61,8 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
public void setObjectMapper(ObjectMapper objectMapper) {
Assert.notNull(objectMapper, "ObjectMapper must not be null");
this.objectMapper = objectMapper;
this.objectMapper = objectMapper.copy();
this.objectMapper.registerModule(new JobParametersModule());
}
public Map<String, Object> deserialize(InputStream in) throws IOException {