小知识:引入properties时,遇到@Value("${xxxxx}")时,报注入失败的错误

经过分析,应该yml的配置方式出现问题,进行格式调整:

修改前:

exchange:
  order: "exchange.order"
queue.
  order:
    create:
      mc-spc-order-service: "queue.order.create.mc-spc-order-service"
      result:
        mc-spc-order-service: "queue.order.create.result.mc-spc-sales-service"
    cancel:
      mc-spc-order-service: "queue.order.cancel.mc-spc-order-service"
      result:
        mc-spc-order-service: "queue.order.cancel.result.mc-spc-sales-service"

 

修改后:

exchange-name:
  mc-spc-order-service: exchange.order
routing-key:
  order-create:
    mc-spc-order-service: queue.order.create.mc-spc-order-service
  order-cancel:
    mc-spc-order-service: queue.order.cancel.mc-spc-order-service
  order-create-result:
    mc-spc-sales-service: queue.order.create.result.mc-spc-sales-service
  order-cancel-result:
    mc-spc-sales-service: queue.order.cancel.result.mc-spc-sales-service

 

posted @ 2020-02-28 21:37  Michael_Chong  阅读(648)  评论(0编辑  收藏  举报