Uploaded image for project: 'Spring Batch'
  1. Spring Batch
  2. BATCH-2828

Allow for customisation of ObjectMapper in Jackson2ExecutionContextStringSerializer

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.2.0, 4.2.0.RC1
    • Component/s: Core
    • Labels:
      None

      Description

      Link from StackOverflow post: https://stackoverflow.com/a/56949526/945789

       

      There is currently no way to use the current configuration of ObjectMapper in Jackson2ExecutionContextStringSerializer and also provide customisations without copying and pasting code. There was a fix for https://jira.spring.io/browse/BATCH-2680 which resulted in a private jackson module being created: JobParametersModule and being included in the default ObjectMapper setup, however we cannot get access to that if we would like to customise ObjectMapper features.

      I'd like to be able to register additional modules, namely KotlinModule so I can use `data class` for objects stored in execution context without having to mark everything as an optional field. I have seen other posts where people would also like to customise objectMapper.

      Ideally it would be nice to declaratively register additional ObjectMapper features for boot, or allow us to pass in a base ObjectMapper (the default configured one in boot for example) that can then be copied internally with customisations. If that's not so easy then making the objectMapper property protected to allow subclasses to reference would be nice, or even increasing the visibility of JobParametersModule.

      Any help and suggestions greatly appreciated!

       

       

       

       

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mbenhassine Mahmoud Ben Hassine
              Reporter:
              mbyrne00 Matt Byrne
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: