Skip to content

Commit

Permalink
Merge pull request #253 from kay-horst/add_jackson_kotlin_module
Browse files Browse the repository at this point in the history
Add Jackson Kotlin module to ObjectMapper instances
  • Loading branch information
v1r3n authored Sep 4, 2024
2 parents 6f988f1 + 279ec23 commit b21f014
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
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;
}
}
1 change: 1 addition & 0 deletions 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 "org.glassfish.jersey.core:jersey-client:${revJersey}"
Expand Down
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 b21f014

Please sign in to comment.