在akka配置中重用变量

时间:2016-12-28 10:46:48

标签: scala akka config

如何在其他几个属性中重用配置属性?我简化的现实示例如下所示:

myApp {

  host = "www.myfoohost.com"

  urls {
    url1 = host + "/b" // this...
    url2 = host + "/a" // ... and this do not work
  }
}

1 个答案:

答案 0 :(得分:4)

在Typesafe配置中调用substitutions,它使用${}注释:

myApp {
  host = "www.myfoohost.com"

  urls {
    url1 = ${myApp.host}"/b"
    url2 = ${myApp.host}"/a"
  }
}