Skip to content

Serialization

SerializationUtil is a static class that enables to serialize and deserialize an object.

It is used to save the state of an object in order to be able to recreate it when needed (at the start or restart of a job). For security reasons, the Summer Batch framework needs to know which assemblies are part of your batch. In order to achieve that a file appsettings.json has to be added to your project root to set up the assemblyName property.

Add all the assemblies containing objects susceptible to make their way in the job or step context. The syntax accepts wildcards and recognizes all sub-assemblies.

Example 7.30. Examples with and without wildcard in the appsettings.json


{
    "Deserialization": {
        "assemblyName": [
        "com.myassembly",
        "com.assembly.other.*"
        ]
    }
}

Note

  • Please be sure to select the 'Copy Always' option in 'Copy to Output Directory' for the file appsettings.json. (default is 'Do not copy' which will cause runtime issues)

    Figure 8.1. Setting properties for the appsettings.json configuration file

    gs_appsettings_properties

Caution

If you forget to set up the appsettings.json, you might face serialization exceptions at the start or restart of your job.