Skip to content

Instantly share code, notes, and snippets.

@billydh
Created November 27, 2020 20:59
Show Gist options
  • Save billydh/43b40a6e4d655eaa57fd033c199f5c2d to your computer and use it in GitHub Desktop.
Save billydh/43b40a6e4d655eaa57fd033c199f5c2d to your computer and use it in GitHub Desktop.
package com.thecodebrews.kotlinspringvaluedemo
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import javax.annotation.PostConstruct
@SpringBootApplication
class KotlinspringvaluedemoApplication {
@Value("\${store.name}")
val storeName: String = ""
@Value("\${store.address}")
val storeAddress: String = ""
@PostConstruct
fun getStoreInfo(): Unit {
println("Store name: $storeName")
println("Store address: $storeAddress")
}
}
fun main(args: Array<String>) {
runApplication<KotlinspringvaluedemoApplication>(*args)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment