Issue
In my Spring Boot application I have configured following JMS Listener:
@Component
public class Consumer {
@JmsListener(destination = "image.index.queue")
public void receiveQueue(IndexRequest indexRequest) {
...
}
}
How to supply destination name image.index.queue
from configuration (e.g. application.properties
) instead of a hardcoded value?
Solution
import org.springframework.beans.factory.annotation.Value;
@JmsListener(destination = @Value("${jmx.image.index.queue}")
public void receiveQueue(IndexRequest indexRequest) {
...
}
And in your properties file
jmx.image.index.queue=image.index.queue
Answered By - techtabu
Answer Checked By - David Goodson (JavaFixing Volunteer)