You can also use the @Value annotation within the constructor:
class Test(
@Value("\${my.value}")
private val myValue: Long
) {
//...
}
This has the benefit that your variable is final and none-nullable. I also prefer constructor injection. It can make testing easier.