Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Jackson Kotlin module to ObjectMapper instances #253

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
Loading