Mule-Groovy组件内部的Spring属性占位符 [英] Mule- Access spring property placeholder inside groovy component

查看:92
本文介绍了Mule-Groovy组件内部的Spring属性占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以直接在a子流中使用的groovy脚本文件中访问spring属性placheolder

Is there a way I can access spring property placheolder directly inside groovy script file used in a mule Flow

这样的作品行吗? .假设ftp.server.url是spring加载的application.properties中的一个属性

Would something like this work? . Assuming that 'ftp.server.url' is a property in application.properties loaded by spring

<context:property-placeholder location="classpath:application.properties" />

Ex Groovy脚本:

Ex Groovy script:

def ftpClient =new FTPClient().with {
    connect ${ftp.server.url}
}

推荐答案

如果您的脚本嵌入在Mule XML配置中,则应该可以:

If your script is embedded in the Mule XML config, this should work:

def ftpClient =new FTPClient().with {
    connect "${ftp.server.url}"
}

这篇关于Mule-Groovy组件内部的Spring属性占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆