groovy:如何访问属性文件? [英] groovy: How to access to properties file?
本文介绍了groovy:如何访问属性文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Groovy应用程序,我想以编程方式访问message.properties中定义的属性
。
作为一个测试,我尝试过以下内容:
printlncapacity.created+ $ {message.properties ['capacity.created']}
但它不起作用(抛出异常)。
任何帮助都是值得欢迎的
Luis
解决方案
直接访问消息属性无法重新读取所有
消息属性文件(message_de.properties,message_fr.properties等)
这很容易。
message(code:capacity.created)
,它的工作原理!
Luis
I have a Groovy application and I want to access programatically to a property defined in message.properties.
As a test I've tried the following:
println "capacity.created " + ${message.properties['capacity.created']}
But it doesn't work (throws an exception).
Any help is welcome
Luis
解决方案
I found a way to access to message properties directly wothout re-reading all the messages properties files (message_de.properties, message_fr.properties, etc.) It is is very easy.
message(code:"capacity.created")
and it works!
Luis
这篇关于groovy:如何访问属性文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文