Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-9972

Auto Configuration for Java8/JSR-310 Date-Time types in Spring Boot

    XMLWordPrintable

    Details

      Description

      Currently users have to write code in order to enable java 8 date/time types in Spin

      The idea behind this feature request would be to provide spring boot auto configuration that did this - triggered by a maven dependency.
      The exact configuration could then be done be done as (spring boot) yaml parameters.

      For reference, this is what a user would do:

      1 - add the maven dependency

      <dependency>
            <groupId>org.camunda.spin</groupId>
            <artifactId>camunda-spin-dataformat-json-jackson</artifactId>
            <version>1.6.5</version>
      </dependency>
      

      2 - register javatimemodule through a DataFormatConfigurator

      @Component
      public class CamundaJacksonFormatConfigurator implements DataFormatConfigurator<JacksonJsonDataFormat> {
        @Override
        public Class<JacksonJsonDataFormat> getDataFormatClass() {
          return JacksonJsonDataFormat.class;
        }
      
        @Override
        public void configure(JacksonJsonDataFormat dataFormat) {
      
          final ObjectMapper mapper = dataFormat.getObjectMapper();
          final JavaTimeModule javaTimeModule = new JavaTimeModule();
          mapper.registerModule(javaTimeModule);
        }
      }
      

      3 - create file entry in META-INF/services/org.camunda.spin.spi.DataFormatConfigurator in order to register component (CamundaJacksonFormatConfigurator )

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              meyer Daniel Meyer
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: