【问题标题】:Loading Properties file into Components in Mule将属性文件加载到 Mule 中的组件中
【发布时间】:2013-09-13 00:42:57
【问题描述】:

我有一个属性文件,我想将它转换为一个 java 对象,该对象将在所有流的 java 组件中使用。 Mule CE 3.4 中最好的方法是什么

【问题讨论】:

  • 您有一个 .properties 文件,其中包含 baseURL=localhost 之类的属性,并且您需要将一些属性注入到 Spring bean 中?我说的对吗?
  • 是的,完全正确。并在不同流程的不同组件中使用它
  • 在你的 bean 中注入 ${baseUrl}

标签: spring mule esb


【解决方案1】:

将属性解析器添加到您的配置中。它主要在 applicationContext.xml 中完成。我不确定您的配置是否相同。

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

然后,您的属性可以在 @Value 注释的帮助下在您的 bean 中解析。

@Value("${PropertyName}")
private String propertyValue,

//Setter getter

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-02
    • 1970-01-01
    • 2014-01-09
    • 2016-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多