Reputation: 31
I try to create a KafkaListener in Kotlin with
@KafkaListener(topics = "<TOPIC_NAME>")
For I want to use a kotlin constant
I tried to access it with:
@KafkaListener(topics = "\${T(package.name.Class).CONST}")
kotlin class:
package package.name
class Class{
companion object{
const val CONST = "desired-topic-name"
}
}
I'm getting a "Could not resolve placeholder" error message but would expect to use the constant
Upvotes: 0
Views: 1379
Reputation: 31
I was thinking way too far:
In the end I just used
@KafkaListener(topics = "${package.name.Class.CONST}"
and it works like a charm
Upvotes: 1
Reputation: 174729
You need to use #
instead of $
. $
is a simple property placeholder.
Upvotes: 1