如何在 Config.Groovy 中使用设置的变量并将其连接起来

发布于 2024-09-02 11:49:03 字数 666 浏览 1 评论 0原文

我想重用稍后在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜清冷一曲。 2024-09-09 11:49:03

你尝试过吗:

bar.default.picUrl="${static.serverURL}${static.path}"/images/bar.png

Did you try:

bar.default.picUrl="${static.serverURL}${static.path}"/images/bar.png
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文