http://docs.groovy-lang.org/latest/html/gapi/groovy/util/ConfigSlurper.html#parse(groovy.lang.Script,%20java.net.URL)

--ConfigSlurper() API 文档链接

 

读取groovy的配置文件 :
Config.Groovy:

province {
    city {
        name = '深圳'
    }
    capital = "广州"

}

 

def config = new ConfigSlurper().parse(new File("Config.Groovy").toURI().toURL())
println config.province.capital
println config.province.city.name
//输出:
//广州
//深圳

 

从人家这拿的个小例子
https://www.jianshu.com/p/5b3215d0f7c6


相关文章:

  • 2021-12-01
  • 2022-01-15
  • 2021-06-26
  • 2021-07-06
猜你喜欢
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-02-11
  • 2021-11-22
相关资源
相似解决方案