- Camunda Platform 7.15.5
- Spring Boot Starter 2.5.X
Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):
REST API cannot serialize java.time.* values.
- Create a custom Pojo with a field of type java.time.LocalDate
- Store an object of this Pojo as a process variable
- In Cockpit, view the variable value (inspect variable dialog)
The variable endpoint GET /variable-instance/[ID] returns status code 400 with the following response:
The object typed variable is deserialized and serialized again in the REST API and can be displayed in Cockpit.
- Starting with Jackson Databind 2.12 java.time.* values cannot be serialized anymore when the com.fasterxml.jackson.datatype:jackson-datatype-jsr310 is not registered in the ObjectMapper .
- For the Spring Boot Starter with
CAM-9972we implemented that it automatically configures and registers the module for the ObjectMapper used in the engine when the module is available on the classpath
- We don't have such logic for the ObjectMapper configured in the REST API 
- While with Jackson Databind < 2.12 users did not have this problem since the library applied its default strategies to serialize a java.time.* object as it does for any other Pojo
- In JacksonConfigurator#configureObjectMapper, call ObjectMapper#findAndRegisterModules
- This registers all Jackson modules that are available on the classpath automatically (via a service loader descriptor present in the respective module)
- Make it possible to configure JacksonConfigurator for jackson modules similar to how we do it already for the date format (via a static field)
- Make JacksonConfigurator configurable for users and call ObjectMapper#findAndRegisterModules only in the Spring Boot Starter
- Use the Spring Boot Starter's ObjectMapper bean in the REST API and configure it accordingly
- Use the engine's ObjectMapper in the REST API
- Using ObjectMapper#findAndRegisterModules could simplify the implementation of
CAM-9972tremendously and make it more robust.
- When this is fixed, update the migration guide that the serialization format of java.time.* values have changed.
- This is probably also a problem in context of other application servers and not only for Spring Boot