兄弟,你想復(fù)雜了,請你先用2分鐘大致看下SpEL表達(dá)式的語法:
下面這個(gè)是我全局配置文件中的一個(gè)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 動(dòng)態(tài)隊(duì)列名稱:Attribute value must be constant因?yàn)槎鄼C(jī)環(huán)境fanout廣播模式,每臺機(jī)器需要使用自己的隊(duì)列接受消息所以嘗試使用以下的方案 but...果斷報(bào)錯(cuò):Attribute value must be consta...