I want to have Spring Boot application to run as command line application.
I would like to provide additional properties that would come from command line arguments and be merged with properties in application.yaml
When I use Properties
then application.yaml
is omitted. How I can merge properties from two sources?
@SpringBootApplication
class MyMain
fun main(args: Array<String>) {
val properties = Properties().apply {
setProperty("foo", // value from command line args)
}
SpringApplicationBuilder(MyMain::class.java)
.web(WebApplicationType.NONE)
.properties(properties)
.initializers(BeansInitializer())
.run(*args)
}