The goal is to provide a nice way to provide configuration to plain kotlin/java projects similar to how spring does it configuration.
Still in progress. However the goal is to use it as follows:
Given a yml property file:
# application-default.yml
name: MyApp
language: kotlin
id: 1
In any class that you'd like to "inject" a configuration, use the annotation as follows
@Config
class MarvelUniverse {
init {
println("name: ${MarvelUniverse_Config.name}")
println("language: ${MarvelUniverse_Config.language}")
}
}
fun main() {
MarvelUniverse()
}
// outputs
name: MyApp
language: kotlin
id: 1
After compilation, a source file is generated to be used within the class named ClassName_Config
.
Annotation processing has limitations where you cannot modify an existing class, so it's not a true "injection". The processor just creates a static output Class.