Search code examples
springspring-bootspring-mvcannotationsplaceholder

SpringBoot property value inside annotation


I have this annotation

@Listener(topics = "test")

that I want to relace with

@Listener(topics = "@Value(\"${topics}\")")

but I have this error

Could not resolve placeholder 'topics' in value "@Value("${topics}")"

Solution

  • Try:

    @Listener(topics = "${topics}")
    

    and make sure the property actually exists.

    (Not a 100% sure that it works, but somewhat confident ;) )