在我的Spring Boot应用程序中,我已经配置了以下JMS Listener:
@Component
public class Consumer {
@JmsListener(destination = "image.index.queue")
public void receiveQueue(IndexRequest indexRequest) {
...
}
}
如何提供目的地名称" image.index.queue"从配置(application.properties)而不是硬编码值?
答案 0 :(得分:4)
import org.springframework.beans.factory.annotation.Value;
@JmsListener(destination = @Value("${jmx.image.index.queue}")
public void receiveQueue(IndexRequest indexRequest) {
...
}
在你的属性文件中
jmx.image.index.queue=image.index.queue