配置文件名:application.conf,
VM options: -Dconfig.file=application.conf
配置文件内容规范:
openStrategy{
alive
{
application = "openStrategy" interval = routingKeyPrefix = "alive."
}
}
class A(val configPrefix: String)
{
//这里入参configPrefix是openStrategy.alive, 所以 下面的application 就是openStrategy,下面的参数也就是配置文件中某个参数的路径
private val application = context.system.settings.config.getString(configPrefix + ".application")
//同理,想获取interval就是
private val interval = context.system.settings.config.getInt(configPrefix + ".interval")
}
注释配置文件用#