Currently, it seems we are forced to use Kotlin classes with mutable nullable properties and default constructor with @ConfigurationProperties while idiomatic Kotlin code would be using classes with immutable properties initialized via constructor. I think there is a way to supporting that by leveraging kotlin-reflect library like jackson-module-kotlin do.
More concretely, in MiXiT app I would like to be able to convert this MixitProperties class implementation to:
@ConfigurationProperties("mixit")
class MixitProperties(
val baseUri: String,
val admin: Credential,
val drive: Drive
)
class Credential(
val username: String,
val password: String
)
class Drive(
val fr: DriveDocuments,
val en: DriveDocuments
)
class DriveDocuments(
val sponsorform: String,
val sponsor: String,
val speaker: String,
val press: String
)
We could imagine to support optional properties by using nullable types, like val sponsorform: String? for example.
I will be happy to help. I have also already worked with @apatrida who maintains Jackson Kotlin module, he may provide us some guidance I think.
Currently, it seems we are forced to use Kotlin classes with mutable nullable properties and default constructor with
@ConfigurationPropertieswhile idiomatic Kotlin code would be using classes with immutable properties initialized via constructor. I think there is a way to supporting that by leveragingkotlin-reflectlibrary likejackson-module-kotlindo.More concretely, in MiXiT app I would like to be able to convert this
MixitPropertiesclass implementation to:We could imagine to support optional properties by using nullable types, like
val sponsorform: String?for example.I will be happy to help. I have also already worked with @apatrida who maintains Jackson Kotlin module, he may provide us some guidance I think.