From 68542c38fe300cd5b5c4c821a9ddfb0057259f76 Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Thu, 15 Dec 2022 10:34:19 +0100 Subject: [PATCH] Enable kotlin features when loading config --- .../kotlin/org/radarbase/jersey/config/ConfigLoader.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radar-jersey/src/main/kotlin/org/radarbase/jersey/config/ConfigLoader.kt b/radar-jersey/src/main/kotlin/org/radarbase/jersey/config/ConfigLoader.kt index c4cad48..660fda5 100644 --- a/radar-jersey/src/main/kotlin/org/radarbase/jersey/config/ConfigLoader.kt +++ b/radar-jersey/src/main/kotlin/org/radarbase/jersey/config/ConfigLoader.kt @@ -2,6 +2,7 @@ package org.radarbase.jersey.config import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.dataformat.yaml.YAMLFactory +import com.fasterxml.jackson.module.kotlin.KotlinFeature import com.fasterxml.jackson.module.kotlin.kotlinModule import org.glassfish.jersey.internal.inject.AbstractBinder import org.glassfish.jersey.server.ResourceConfig @@ -64,7 +65,13 @@ object ConfigLoader { logger.info("Reading configuration from {}", configFile.toAbsolutePath()) return try { val localMapper = mapper ?: ObjectMapper(YAMLFactory()) - .registerModule(kotlinModule()) + .registerModule(kotlinModule { + enable(KotlinFeature.NullToEmptyMap) + enable(KotlinFeature.NullToEmptyCollection) + enable(KotlinFeature.NullIsSameAsDefault) + enable(KotlinFeature.SingletonSupport) + enable(KotlinFeature.StrictNullChecks) + }) Files.newInputStream(configFile).use { input -> BufferedInputStream(input).use { bufInput ->