我们可以重用在 Grails 配置文件中定义的属性。一个简单的例子:
accountFake = '12345678901234567890'
accountValid = '09876543210987654321'
environments {
development {
payments.info.transfer.accountNumber = "${accountFake}"
}
test {
payments.info.transfer.accountNumber = "${accountFake}"
}
preproduction {
payments.info.transfer.accountNumber = "${accountFake}"
}
production {
payments.info.transfer.accountNumber = "${accountValid}"
}
}
是否可以将此变量的范围定义为私有?我不希望在配置文件之外读取这些变量。