如何在groovy中获得变量的值
String elkEndpoint = 'https://elastic.beta.tower.am.health.ge.com/'
我需要使用elkendpoint的值
在代码中的某个地方如下:
// Some code
'metrics': [
'elasticEndpoint': elkEndpoint,
'esConnection': ''
],
// Some code
我尝试使用以下,但它不起作用:
- 'ElasticendPoint':elkendpoint, 2“弹性点”:$ {elkendpoint}, 3“弹性点”:$ elkendpoint,
使用变量值的方法是什么?
String elkEndpoint = 'https://elastic.beta.tower.am.health.ge.com/'
I need to use value of elkEndpoint
somewhere in code like below:
// Some code
'metrics': [
'elasticEndpoint': elkEndpoint,
'esConnection': ''
],
// Some code
I tried using below, but its not working:
- 'elasticEndpoint': elkEndpoint,
2 'elasticEndpoint': ${elkEndpoint},
3 'elasticEndpoint': $elkEndpoint,
What is way to use value of a variable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做到这一点:
这将输出以下内容:
You can do this:
That will output the following: