如何在 Config.Groovy 中使用设置的变量并将其连接起来
我想重用稍后在 Config.groovy
示例中再次设置的变量:
static.serverURL = "http://static.foo.com"
static.path = ""
bar.default.picUrl=static.serverURL+static.path+"/images/bar.png"
但这给了我一个
groovy.util.ConfigObject.plus() is applicable for argument types: (java.lang.String)
将其更改为
bar.default.picUrl=""+static.serverURL+static.path+"/images/bar.png"
给我
[:][:]/images/bar.png
使用
bar.default.picUrl=${static.serverURL}+${static.path}+"/images/bar.png"
给我
nullnull/images/bar.png
I want to reuse vars setted once again later in Config.groovy
Example:
static.serverURL = "http://static.foo.com"
static.path = ""
bar.default.picUrl=static.serverURL+static.path+"/images/bar.png"
but that gives me a
groovy.util.ConfigObject.plus() is applicable for argument types: (java.lang.String)
changing it to
bar.default.picUrl=""+static.serverURL+static.path+"/images/bar.png"
gives me
[:][:]/images/bar.png
using
bar.default.picUrl=${static.serverURL}+${static.path}+"/images/bar.png"
gives me
nullnull/images/bar.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你尝试过吗:
Did you try: