twogood / kronslott-object-mapper

DropWizard bundle to configure the Jackson ObjectMapper. Part of Project Kronslott.

Home Page:https://medium.com/@davideriksson_91895/dropwizard-kotlin-project-kronslott-e2aa51b277b8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project Kronslott

DropWizard ObjectMapper configuration

DropWizard bundle to configure the Jackson ObjectMapper

Use this only if you want to make Jackson ObjectMapper settings configurable in your DropWizard configuration. Otherwise you could just hardcode the values you want!

From start, there is only one configuration option available: writeDatesAsTimestamps.

Usage

example.yml

objectMapper:
  writeDatesAsTimestamps: false

example.kt

class ExampleConfig : Configuration(), ObjectMapperConfig {
    @Valid
    @JsonProperty("objectMapper")
    override var objectMapperSettings: ObjectMapperSettings = ObjectMapperSettings()
   
    // ...
}

class ExampleApp : Application<ExampleConfig>() {

    override fun initialize(bootstrap: Bootstrap<ExampleConfig>) {
        bootstrap.addBundle(ObjectMapperBundle<ExampleConfig>())
        // ...
    }
    
    // ...
}    

Adding this library to your project

This project is not yet available from Maven Central Repository, but it's available via JitPack.io.

About

DropWizard bundle to configure the Jackson ObjectMapper. Part of Project Kronslott.

https://medium.com/@davideriksson_91895/dropwizard-kotlin-project-kronslott-e2aa51b277b8

License:MIT License


Languages

Language:Kotlin 50.6%Language:Java 49.4%