package Ġcom . github . j oost v dg . app register Ċ Ċ import Ġcom . fasterxml . jackson . databind . ObjectMapper Ċ import Ġcom . fasterxml . jackson . datatype . jdk 8 . J dk 8 Module Ċ import Ġcom . fasterxml . jackson . datatype . js r 3 1 0 . Java Time Module Ċ import Ġcom . fasterxml . jackson . module . kotlin . Kotlin Module Ċ import Ġcom . fasterxml . jackson . module . param names . Parameter Names Module Ċ import Ġorg . elasticsearch . client . Client Ċ import Ġorg . springframework . boot . autoconfigure . SpringBoot Application Ċ import Ġorg . springframework . boot . run Application Ċ import Ġorg . springframework . cloud . client . discovery . Enable Discovery Client Ċ import Ġorg . springframework . context . annotation . Bean Ċ import Ġorg . springframework . context . annotation . Configuration Ċ import Ġorg . springframework . data . elasticsearch . core . Default Result Mapper Ċ import Ġorg . springframework . data . elasticsearch . core . Elasticsearch Template Ċ import Ġorg . springframework . data . elasticsearch . core . Entity Mapper Ċ import Ġorg . springframework . stereotype . Component Ċ Ċ @ SpringBoot Application Ċ @ Enable Discovery Client Ċ open Ġclass ĠApp Register Application Ċ Ċ fun Ġmain ( args : ĠArray < String >) Ġ{ ĊĠĠĠ Ġrun Application < App Register Application >(* args ) Ċ } Ċ Ċ @ Bean Ċ fun ĠobjectMapper (): ĠObjectMapper Ġ= ĊĠĠĠ ĠObjectMapper () ĊĠĠĠĠĠĠĠ Ġ. register Module ( Java Time Module ()) ĊĠĠĠĠĠĠĠ Ġ. register Module ( Parameter Names Module ()) ĊĠĠĠĠĠĠĠ Ġ. register Module ( J dk 8 Module ()) ĊĠĠĠĠĠĠĠ Ġ. register Module ( Kotlin Module ()) Ċ Ċ @ Configuration Ċ open Ġclass ĠElasticsearch Config ( val Ġelasticsearch Entity Mapper : ĠElasticsearch Entity Mapper ) Ġ{ ĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġopen Ġfun Ġelasticsearch Template ( client : ĠClient ) Ġ= ĠElasticsearch Template ( client , ĠDefault Result Mapper ( elasticsearch Entity Mapper )) Ċ } Ċ Ċ @ Component Ċ class ĠElasticsearch Entity Mapper ( val ĠobjectMapper : ĠObjectMapper ) Ġ: ĠEntity Mapper Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġmap ToString (` object `: ĠAny ?) Ġ= ĠobjectMapper . writeValue AsString (` object `) ĊĠĠĠ Ġoverride Ġfun Ġ< T Ġ: ĠAny ?> Ġmap ToObject ( source : ĠString ?, Ġclazz : ĠClass < T > ?) Ġ= ĠobjectMapper . readValue ( source , Ġclazz ) Ċ } Ċ