小知识:引入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

猜你喜欢

转载自www.cnblogs.com/chongpf/p/12380392.html