Class SpinJacksonSupport

java.lang.Object
org.camunda.bpm.spring.boot.starter.spin.SpinJacksonSupport

public final class SpinJacksonSupport extends Object
Tells apart the Jackson 2 and the Jackson 3 Spin JSON data format at runtime.

Both variants ship the same fully qualified class name org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat — the Jackson 3 module is generated from the Jackson 2 sources by the Eclipse Transformer. They differ only in the return type of getObjectMapper(): com.fasterxml.jackson.databind.ObjectMapper vs. tools.jackson.databind.ObjectMapper.

That makes the return type the only precise discriminator. In particular it cannot be done by checking whether tools.jackson.databind.ObjectMapper is on the classpath: Spring Boot 4 ships Jackson 3 itself (spring-boot-starter-web → spring-boot-starter-jackson → spring-boot-jackson → tools.jackson.core:jackson-databind), so that class is present for virtually every user, including those running the default Jackson 2 Spin stack.

It also cannot be done with an instanceof inside CamundaJacksonFormatConfigurator*#configure(...): the JVM resolves methods by name and full descriptor including return type, so the Jackson-2-compiled getObjectMapper() call site raises a NoSuchMethodError against the Jackson 3 variant before any instanceof could run. The probe has to happen before the call.

  • Method Details

    • hasJackson2ObjectMapper

      public static boolean hasJackson2ObjectMapper(Class<?> dataFormatClass)
      Returns:
      true if the given class exposes a getObjectMapper() returning a Jackson 2 ObjectMapper, i.e. if it is the Jackson 2 Spin JSON data format.
    • hasJackson2SpinDataFormat

      public static boolean hasJackson2SpinDataFormat(ClassLoader classLoader)
      Returns:
      true if the Spin JSON data format visible to the given class loader is the Jackson 2 variant. false if it is the Jackson 3 variant or absent entirely.