Created
May 22, 2016 17:06
-
-
Save lynas/15ed8a3194c221563b55bf44363053f7 to your computer and use it in GitHub Desktop.
Jackson Kotlin Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jackson Kotlin Module | |
If you are using Jackson you are likely to want to add com.fasterxml.jackson.module:jackson-module-kotlin dependency in order to allow it to deal with data classes with no default constructor or with Kotlin collections. | |
In addition to the dependency, you need to register it in Jackson ObjectMapper: | |
@SpringBootApplication | |
open class Application { | |
@Bean | |
open fun objectMapperBuilder(): Jackson2ObjectMapperBuilder | |
= Jackson2ObjectMapperBuilder().modulesToInstall(KotlinModule()) | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment