Skip to content

Commit

Permalink
Enable kotlin features when loading config
Browse files Browse the repository at this point in the history
  • Loading branch information
blootsvoets committed Dec 15, 2022
1 parent 233400f commit 68542c3
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ->
Expand Down

0 comments on commit 68542c3

Please sign in to comment.