ale*_*oid 2 spring jms spring-annotations spring-boot
在我的Spring Boot应用程序中,我配置了以下JMS侦听器:
@Component
public class Consumer {
@JmsListener(destination = "image.index.queue")
public void receiveQueue(IndexRequest indexRequest) {
...
}
}
Run Code Online (Sandbox Code Playgroud)
如何从配置(application.properties)中提供目标名称“ image.index.queue”,而不是硬编码值?
import org.springframework.beans.factory.annotation.Value;
@JmsListener(destination = @Value("${jmx.image.index.queue}")
public void receiveQueue(IndexRequest indexRequest) {
...
}
Run Code Online (Sandbox Code Playgroud)
并在您的属性文件中
jmx.image.index.queue=image.index.queue
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1967 次 |
| 最近记录: |