兄弟,你想復雜了,請你先用2分鐘大致看下SpEL表達式的語法:
下面這個是我全局配置文件中的一個bean
讀取配置文件
@Bean("rabbitConfigProperties")
public Properties rabbitConfigProperties(){...}
下面是我service層的代碼
@RabbitHandler
@RabbitListener(queues = {"#{rabbitConfigProperties.getProperty('rabbit.queue-map.goods-service.queue-name')}"})
public void messageHandler(Message message, Channel channel){...}
最后,謝謝你,給了我靈感因妇,終于解決了注解參數(shù)的配置問題 -_-
springboot+RabbitMQ 問題 RabbitListener 動態(tài)隊列名稱:Attribute value must be constant因為多機環(huán)境fanout廣播模式,每臺機器需要使用自己的隊列接受消息所以嘗試使用以下的方案 but...果斷報錯:Attribute value must be consta...