大佬教程收集整理的这篇文章主要介绍了如何在属性文件中使用 groovy 形式参数,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有这样一个属性文件:
$('.checkoutwrap .aantal').on("change",debounce(function(E) {
e.preventDefault();
var productID = $(this).siblings('.productID').val();
var quantity = $(this).val();
var form_data = $("#formsID form").serialize();
$.AJAX({
type:'post',url:"checkout/prices.php",data:({productID: productID,quantity: quantity}),@R_450_6048@s:function(data){
$($pricediv).empty().append( data );
refreshcoupon(true);
}
});
},300)) ;
当我从我的属性文件中获取例如 API.host 属性时:
envHost=http://some.host
API.host=${envHost}
BACkoffice.host=${envHost}
我得到 inputStream input = new fileinputStream(new file(getClass().getresource("/envs/someEnv.propertIEs").toURI()))
PropertIEs prop = new PropertIEs();
prop.load(input)
println prop.'API.host'
而不是 ${envHost}
如何使用其中的形式参数从属性文件中获取值 http://some.host
?
如果您可以将属性文件更改为 config-slurper 有效格式:
envHost="http://some.host"
api.host=envHost
BACkoffice.host=envHost
然后你可以这样做:
def cfg = new ConfigSlurper().parse(getClass().getresource("/envs/someEnv.properties"))
println cfg.api.host
它应该可以工作
以上是大佬教程为你收集整理的如何在属性文件中使用 groovy 形式参数全部内容,希望文章能够帮你解决如何在属性文件中使用 groovy 形式参数所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。