Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如:
配置.groovy:
// ... grails.variable1 = "a" grails.varibale2 = "${grails.variable1}bc" //...
更新 1
上面显示的方式适用于 grails 2.2.3。对于旧版本的 grails,请使用建议的解决方案 @tim_yates
您需要声明一个变量:
def rootVar = 'a' grails.variable1 = rootVar grails.varibale2 = "${rootVar}bc"
或者您可以通过闭包(未测试)来做到这一点:
grails.variable1 = 'a' grails.varibale2 = { -> "${grails.variable1}bc" }()