Skip to content

Commit a15a6bf

Browse files
committed
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
1 parent 5be1c9a commit a15a6bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/Jackson2ExecutionContextStringSerializer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2008-2018 the original author or authors.
2+
* Copyright 2008-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -61,7 +61,8 @@ public Jackson2ExecutionContextStringSerializer() {
6161

6262
public void setObjectMapper(ObjectMapper objectMapper) {
6363
Assert.notNull(objectMapper, "ObjectMapper must not be null");
64-
this.objectMapper = objectMapper;
64+
this.objectMapper = objectMapper.copy();
65+
this.objectMapper.registerModule(new JobParametersModule());
6566
}
6667

6768
public Map<String, Object> deserialize(InputStream in) throws IOException {

0 commit comments

Comments
 (0)