Skip to content
HOA PHAN edited this page Mar 15, 2024 · 4 revisions

Is good, for lot of cases but when using Spring:

Inject property:

@Value("${MY_NAME:s50600822}")
public final String name;

now you have to escape it:

@Value("\${MY_NAME:s50600822}")
public final String name;

And then if it's primitive type:

@Value("${CON_TIMEOUT:60}")
public int timeout;

(good luck in Kotlin)

    @Value("\${NEWRELIC_INSIGHTKEY:}")
    var  insightKey = ""
    @Value("\${NEWRELIC_INTERVAL_SEC:5}")
    var  interval = 5 // no primitive type babe

https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib/samples/test/samples

eye

Clone this wiki locally