Skip to content

Commit

Permalink
Add Jackson Kotlin module to ObjectMapper instances
Browse files Browse the repository at this point in the history
  • Loading branch information
Kay Ulbrich committed Sep 3, 2024
1 parent 9fef8fd commit 279ec23
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies {
implementation "com.fasterxml.jackson.core:jackson-core:${revFasterXml}"
// https://github.com/FasterXML/jackson-modules-base/tree/master/afterburner
implementation "com.fasterxml.jackson.module:jackson-module-afterburner:${revFasterXml}"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:${revFasterXml}"

testImplementation 'org.springframework.boot:spring-boot-starter-validation'
testImplementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${revSpringDoc}"
Expand Down Expand Up @@ -53,4 +54,3 @@ task protogen(dependsOn: jar, type: JavaExec) {
"com.netflix.conductor.common",
)
}

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
import com.fasterxml.jackson.module.kotlin.KotlinModule;

/**
* A Factory class for creating a customized {@link ObjectMapper}. This is only used by the
Expand Down Expand Up @@ -58,6 +59,7 @@ private static ObjectMapper _getObjectMapper() {
objectMapper.registerModule(new JsonProtoModule());
objectMapper.registerModule(new JavaTimeModule());
objectMapper.registerModule(new AfterburnerModule());
objectMapper.registerModule(new KotlinModule.Builder().build());
return objectMapper;
}
}
2 changes: 1 addition & 1 deletion java-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies {
implementation project(':conductor-client')

implementation "com.fasterxml.jackson.core:jackson-databind:${revFasterXml}"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:${revFasterXml}"
implementation "com.google.guava:guava:${revGuava}"
implementation "cglib:cglib:3.3.0"
implementation "com.sun.jersey:jersey-client:${revJersey}"
Expand All @@ -30,4 +31,3 @@ test {
}
}
sourceSets.main.java.srcDirs += ['example/java', 'example/resources']

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.module.kotlin.KotlinModule;

public class ObjectMapperProvider {

Expand All @@ -35,6 +36,7 @@ public ObjectMapper getObjectMapper() {
// objectMapper.setSerializationInclusion(JsonInclude.Include.);

objectMapper.registerModule(new JsonProtoModule());
objectMapper.registerModule(new KotlinModule.Builder().build());
return objectMapper;
}
}

0 comments on commit 279ec23

Please sign in to comment.