fitzoh
08/01/2017, 4:01 AM@Configuration
@SpringBootApplication
class DemoApplication {
@Bean
fun stringBean() : String? = null
}
@Component
class Runner(val whatever: Whatever) : CommandLineRunner {
override fun run(vararg p0: String?) {
whatever.hello()
}
}
fun main(args: Array<String>) {
SpringApplication.run(DemoApplication::class.java, *args)
}
@Component
class Whatever(val thing: String?) {
fun hello() = println("hello ${thing ?: "world"}")
}