[英]How to get a value of variable in groovy
String elkEndpoint = 'https://elastic.beta.tower.am.health.ge.com/'
我需要在如下代碼中的某處使用elkEndpoint
的值:
// Some code
'metrics': [
'elasticEndpoint': elkEndpoint,
'esConnection': ''
],
// Some code
我嘗試在下面使用,但它不起作用:
什么是使用變量值的方法?
什么是使用變量值的方法?
你可以這樣做:
String elkEndpoint = 'https://elastic.beta.tower.am.health.ge.com/'
Map metrics = [ elasticEndpoint: elkEndpoint, esConnection: '' ]
println metrics
那將 output 以下內容:
[elasticEndpoint:https://elastic.beta.tower.am.health.ge.com/, esConnection:]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.